mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-12 10:15:22 +00:00
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 01d196a67d
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
ac73d88fbc
commit
04fc0a8244
@ -80,7 +80,7 @@ static void picmemset(PicContext *s, AVFrame *frame, int value, int run,
|
|||||||
value <<= bits_per_plane;
|
value <<= bits_per_plane;
|
||||||
mask <<= bits_per_plane;
|
mask <<= bits_per_plane;
|
||||||
if (*plane >= s->nb_planes)
|
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;
|
int run = (y + 1) * avctx->width - x;
|
||||||
if (bits_per_plane == 8)
|
if (bits_per_plane == 8)
|
||||||
picmemset_8bpp(s, frame, val, run, &x, &y);
|
picmemset_8bpp(s, frame, val, run, &x, &y);
|
||||||
|
Loading…
Reference in New Issue
Block a user