aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-10-18 21:54:14 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-09 13:53:29 +0200
commit3ce851aab3acdee92ca0a8d3149de3e3878e28bb (patch)
tree249cafebf3be58fe32a00f6480352e7cd572f590
parentf608e7801634f0ac9b661a22033be06ab5f5180b (diff)
downloadffmpeg-3ce851aab3acdee92ca0a8d3149de3e3878e28bb.tar.gz
avcodec/fits: Check bscale
Fixes: division by 0 Fixes: 26208/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FITS_fuzzer-6270472117026816 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 c2ccd76fd000f69e355280b487213fb63821c8aa) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/fits.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/fits.c b/libavcodec/fits.c
index ad73ab70de..25c33e06c8 100644
--- a/libavcodec/fits.c
+++ b/libavcodec/fits.c
@@ -187,6 +187,8 @@ int avpriv_fits_header_parse_line(void *avcl, FITSHeader *header, const uint8_t
header->blank = t;
header->blank_found = 1;
} else if (!strcmp(keyword, "BSCALE") && sscanf(value, "%lf", &d) == 1) {
+ if (d <= 0)
+ return AVERROR_INVALIDDATA;
header->bscale = d;
} else if (!strcmp(keyword, "BZERO") && sscanf(value, "%lf", &d) == 1) {
header->bzero = d;