diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-02-20 12:31:43 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-08-23 13:15:16 +0200 |
commit | 04fc0a82448662057d61f266693070fab0db3d22 (patch) | |
tree | a843375b8d024bade155cc1fb72076fde8ad8c18 /libavcodec/pictordec.c | |
parent | ac73d88fbc016db49def3b01250e17a7375b2952 (diff) | |
download | ffmpeg-04fc0a82448662057d61f266693070fab0db3d22.tar.gz |
avcodec/pictordec: Do not read more than nb_planes
Fixes undefined behavior
Fixes: 622/clusterfuzz-testcase-5745722022428672
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 01d196a67dc55eb01cf3e06d6338c5d096a29b1c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/pictordec.c')
-rw-r--r-- | libavcodec/pictordec.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c index a60cfcbefc..7ae1a81607 100644 --- a/libavcodec/pictordec.c +++ b/libavcodec/pictordec.c @@ -80,7 +80,7 @@ static void picmemset(PicContext *s, AVFrame *frame, int value, int run, value <<= bits_per_plane; mask <<= bits_per_plane; if (*plane >= s->nb_planes) - break; + return; } } } @@ -236,7 +236,7 @@ static int decode_frame(AVCodecContext *avctx, } } - if (x < avctx->width) { + if (plane < s->nb_planes && x < avctx->width) { int run = (y + 1) * avctx->width - x; if (bits_per_plane == 8) picmemset_8bpp(s, frame, val, run, &x, &y); |