mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avcodec/msp2dec: Check available space in RLE decoder
Fixes: out of array read Fixes: 32968/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSP2_fuzzer-5315296027082752 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
44c8b67502
commit
caaf463311
@ -71,6 +71,7 @@ static int msp2_decode_frame(AVCodecContext *avctx,
|
|||||||
while (bytestream2_get_bytes_left(&gb) && x < width) {
|
while (bytestream2_get_bytes_left(&gb) && x < width) {
|
||||||
int size = bytestream2_get_byte(&gb);
|
int size = bytestream2_get_byte(&gb);
|
||||||
if (size) {
|
if (size) {
|
||||||
|
size = FFMIN(size, bytestream2_get_bytes_left(&gb));
|
||||||
memcpy(p->data[0] + y * p->linesize[0] + x, gb.buffer, FFMIN(size, width - x));
|
memcpy(p->data[0] + y * p->linesize[0] + x, gb.buffer, FFMIN(size, width - x));
|
||||||
bytestream2_skip(&gb, size);
|
bytestream2_skip(&gb, size);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user