diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-06-06 17:50:21 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-06-08 20:45:56 +0200 |
commit | 8e21379da110ca78f41ff2fe074fd771a1bcd1d0 (patch) | |
tree | eedafe3f0a5fb522e27dd34d1979a446cab40dd3 /libavcodec | |
parent | 3e651eeac4001820a4b1ac6a31974753288bb9ed (diff) | |
download | ffmpeg-8e21379da110ca78f41ff2fe074fd771a1bcd1d0.tar.gz |
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/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/pnm.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c index a6ae01b494..aad23c7ae2 100644 --- a/libavcodec/pnm.c +++ b/libavcodec/pnm.c @@ -179,7 +179,7 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s) if (avctx->pix_fmt == AV_PIX_FMT_GBRPF32) { 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"); return AVERROR_INVALIDDATA; } |