mirror of
https://mirror.skon.top/https://github.com/FFmpeg/FFmpeg
synced 2026-04-20 21:00:41 +08:00
avcodec/pnmdec: Check input size against width*height assuming at least 1bit per pixel
Fixes: Timeout Fixes: 481427018/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PHM_DEC_fuzzer-6315469467615232 Fixes: 485843949/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PHM_DEC_fuzzer-4753439270961152 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:
@@ -63,6 +63,9 @@ static int pnm_decode_frame(AVCodecContext *avctx, AVFrame *p,
|
||||
if (avctx->skip_frame >= AVDISCARD_ALL)
|
||||
return avpkt->size;
|
||||
|
||||
if (avctx->width * avctx->height / 8 > s->bytestream_end - s->bytestream)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
|
||||
return ret;
|
||||
avctx->bits_per_raw_sample = av_log2(s->maxval) + 1;
|
||||
|
||||
Reference in New Issue
Block a user