diff mbox series

[FFmpeg-devel,1/7] avcodec/fits: Check bscale

Message ID 20201019142501.6867-1-michael@niedermayer.cc
State Accepted
Commit c2ccd76fd000f69e355280b487213fb63821c8aa
Headers show
Series [FFmpeg-devel,1/7] avcodec/fits: Check bscale
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Michael Niedermayer Oct. 19, 2020, 2:24 p.m. UTC
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>
---
 libavcodec/fits.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Michael Niedermayer Oct. 24, 2020, 5:07 p.m. UTC | #1
On Mon, Oct 19, 2020 at 04:24:55PM +0200, Michael Niedermayer wrote:
> 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>
> ---
>  libavcodec/fits.c | 2 ++
>  1 file changed, 2 insertions(+)

will apply

[...]
diff mbox series

Patch

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;