[FFmpeg-devel] [PATCH 2/2] avcodec/fitsdec: Prevent division by 0 with huge data_max

Michael Niedermayer michael at niedermayer.cc
Tue Jul 16 01:50:39 EEST 2019


Fixes: division by 0
Fixes: 15657/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FITS_fuzzer-5738154838982656

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/fitsdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/fitsdec.c b/libavcodec/fitsdec.c
index 4f452422ef..fe941f199d 100644
--- a/libavcodec/fitsdec.c
+++ b/libavcodec/fitsdec.c
@@ -174,7 +174,7 @@ static int fits_read_header(AVCodecContext *avctx, const uint8_t **ptr, FITSHead
             return AVERROR_INVALIDDATA;
         }
         av_log(avctx, AV_LOG_WARNING, "data min/max indicates a blank image\n");
-        header->data_max ++;
+        header->data_max += fabs(header->data_max) / 10000000 + 1;
     }
 
     return 0;
-- 
2.22.0



More information about the ffmpeg-devel mailing list