diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-07-12 16:24:18 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-07-19 03:48:00 +0200 |
commit | 506bbbc09929e1d2778259fb9549743c5bce5fdc (patch) | |
tree | 5631470e196d41ab33a30bd75343920605967aae | |
parent | 910878e4d90a0850872336d656b12b77daf15f21 (diff) | |
download | ffmpeg-506bbbc09929e1d2778259fb9549743c5bce5fdc.tar.gz |
avcodec/mjpegdec: Clip DC also on the negative side.
Fixes: runtime error: signed integer overflow: -16711425 + -2130772346 cannot be represented in type 'int'
Fixes: 2533/clusterfuzz-testcase-minimized-5372857678823424
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c28f648b19dd36ff9bc869ad527a1569a0b623e2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/mjpegdec.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 32b6b3b84d..714c51013d 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -693,7 +693,7 @@ static int decode_block(MJpegDecodeContext *s, int16_t *block, int component, return AVERROR_INVALIDDATA; } val = val * quant_matrix[0] + s->last_dc[component]; - val = FFMIN(val, 32767); + val = av_clip_int16(val); s->last_dc[component] = val; block[0] = val; /* AC coefs */ |