Browse code

lavfi/histeq: fix out of array write

Signed-off-by: Paul B Mahol <onemda@gmail.com>

Paul B Mahol authored on 2013/04/17 09:21:17
Showing 1 changed files
... ...
@@ -235,7 +235,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
235 235
                 dst[x + histeq->rgba_map[R]] = r;
236 236
                 dst[x + histeq->rgba_map[G]] = g;
237 237
                 dst[x + histeq->rgba_map[B]] = b;
238
-                oluma = (55 * r + 182 * g + 19 * b) >> 8;
238
+                oluma = av_clip_uint8((55 * r + 182 * g + 19 * b) >> 8);
239 239
                 histeq->out_histogram[oluma]++;
240 240
             }
241 241
         }