summaryrefslogtreecommitdiffstats
path: root/libavcodec/fitsdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-06-13 00:24:53 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-06-30 14:27:04 +0200
commiteb82d19f035f59edf0aee215f02baaea908875de (patch)
tree0d6ec184d853423d6251c6a6dc0c1ee4c5b7c326 /libavcodec/fitsdec.c
parent89b96900fa7c17d0770c9af26af7c3ae36ae0253 (diff)
downloadffmpeg-streaming-eb82d19f035f59edf0aee215f02baaea908875de.zip
ffmpeg-streaming-eb82d19f035f59edf0aee215f02baaea908875de.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>
Diffstat (limited to 'libavcodec/fitsdec.c')
-rw-r--r--libavcodec/fitsdec.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/fitsdec.c b/libavcodec/fitsdec.c
index 67a8bd7..4f45242 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;
}
OpenPOWER on IntegriCloud