Commit 8e21379d authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/pnm: Check scale

Fixes: division by zero
Fixes: 22974/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PFM_fuzzer-6270027077779456

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 3e651eea
...@@ -179,7 +179,7 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s) ...@@ -179,7 +179,7 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
if (avctx->pix_fmt == AV_PIX_FMT_GBRPF32) { if (avctx->pix_fmt == AV_PIX_FMT_GBRPF32) {
pnm_get(s, buf1, sizeof(buf1)); pnm_get(s, buf1, sizeof(buf1));
if (av_sscanf(buf1, "%f", &s->scale) != 1) { if (av_sscanf(buf1, "%f", &s->scale) != 1 || s->scale == 0.0 || !isfinite(s->scale)) {
av_log(avctx, AV_LOG_ERROR, "Invalid scale.\n"); av_log(avctx, AV_LOG_ERROR, "Invalid scale.\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment