1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-15 14:13:16 +02:00

avcodec/pdvdec: Check previous frame before using it

Fixes: load of null pointer of type 'uint8_t' (aka 'unsigned char')
Fixes: 58256/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PDV_fuzzer-4776436325285888

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer
2023-05-02 01:55:34 +02:00
parent ed3691338b
commit 5cc378cc46

View File

@@ -93,7 +93,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
if (!(avpkt->flags & AV_PKT_FLAG_KEY)) { if (prev && !(avpkt->flags & AV_PKT_FLAG_KEY)) {
for (int j = 0; j < (avctx->width + 7) >> 3; j++) for (int j = 0; j < (avctx->width + 7) >> 3; j++)
dst[j] ^= prev[j]; dst[j] ^= prev[j];
prev += prev_frame->linesize[0]; prev += prev_frame->linesize[0];