Commit 11d3fa3db1 for ffmpeg
commit 11d3fa3db19b153301cb2a9e14cb7d87a9ac1a7b
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Sat Nov 14 01:57:51 2026 +0100
avfilter/vf_histogram: avoid a division by 0 when no sample is within the histogram
Fixes: division by zero
Fixes: 8cytnsCgSI9y
Found during triage of the security report AISLE-2026-R0057
Division by zero Replicated through UnModified FFmpeg with UBSAN
diff --git a/libavfilter/vf_histogram.c b/libavfilter/vf_histogram.c
index d9bba08134..b1207f9279 100644
--- a/libavfilter/vf_histogram.c
+++ b/libavfilter/vf_histogram.c
@@ -444,7 +444,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
const int width = s->planewidth[p];
const int mid = s->mid;
double max_hval_log;
- unsigned max_hval = 0;
+ unsigned max_hval = 1;
int starty, startx;
if (!((1 << k) & s->components))