Fixes: out of array read Fixes: 32968/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSP2_fuzzer-5315296027082752
Unified · Split
| @@ -71,6 +71,7 @@ static int msp2_decode_frame(AVCodecContext *avctx, · 70 unmodified lines | ||
| 71 | 71 | while (bytestream2_get_bytes_left(&gb) && x < width) { |
| 72 | 72 | int size = bytestream2_get_byte(&gb); |
| 73 | 73 | if (size) { |
| 74 | + size = FFMIN(size, bytestream2_get_bytes_left(&gb)); | |
| 74 | 75 | memcpy(p->data[0] + y * p->linesize[0] + x, gb.buffer, FFMIN(size, width - x)); |
| 75 | 76 | bytestream2_skip(&gb, size); |
| 76 | 77 | } else { |