diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-06-13 00:24:53 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-11-14 23:30:37 +0100 |
commit | 6aaca5234dd299568bd2acd03d27a22ab731b0b5 (patch) | |
tree | 87f3abfd1671b29ac86cfc841f0fc451cb303221 | |
parent | 80bbb8b85107370ca687edd212736dc41fc52d35 (diff) | |
download | ffmpeg-6aaca5234dd299568bd2acd03d27a22ab731b0b5.tar.gz |
avcodec/fitsdec: Check data_min/max
Fixes: division by 0
Fixes: 15206/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FITS_fuzzer-5657260212092928
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit eb82d19f035f59edf0aee215f02baaea908875de)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/fitsdec.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/fitsdec.c b/libavcodec/fitsdec.c index 67a8bd71f4..4f452422ef 100644 --- a/libavcodec/fitsdec.c +++ b/libavcodec/fitsdec.c @@ -168,6 +168,14 @@ static int fits_read_header(AVCodecContext *avctx, const uint8_t **ptr, FITSHead header->data_min = (header->data_min - header->bzero) / header->bscale; header->data_max = (header->data_max - header->bzero) / header->bscale; } + if (!header->rgb && header->data_min >= header->data_max) { + if (header->data_min > header->data_max) { + av_log(avctx, AV_LOG_ERROR, "data min/max (%g %g) is invalid\n", header->data_min, header->data_max); + return AVERROR_INVALIDDATA; + } + av_log(avctx, AV_LOG_WARNING, "data min/max indicates a blank image\n"); + header->data_max ++; + } return 0; } |