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