diff mbox

[FFmpeg-devel,3/4] avcodec/fitsdec: Fix division be 0 in size check

Message ID 20190613183236.19353-3-michael@niedermayer.cc
State Accepted
Commit 07ffe94c172041cfb03109b9bb6b8bf577332bda
Headers show

Commit Message

Michael Niedermayer June 13, 2019, 6:32 p.m. UTC
Fixes: division by zero
Fixes: 15210/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FITS_fuzzer-5746033243455488

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

Comments

Moritz Barsnick June 14, 2019, 7:46 a.m. UTC | #1
On Thu, Jun 13, 2019 at 20:32:35 +0200, Michael Niedermayer wrote:

> avcodec/fitsdec: Fix division be 0 in size check
Nit:                            ^ by

Moritz
Michael Niedermayer June 25, 2019, 8:39 a.m. UTC | #2
On Fri, Jun 14, 2019 at 09:46:17AM +0200, Moritz Barsnick wrote:
> On Thu, Jun 13, 2019 at 20:32:35 +0200, Michael Niedermayer wrote:
> 
> > avcodec/fitsdec: Fix division be 0 in size check
> Nit:                            ^ by

will push without the typo

thanks

[...]
diff mbox

Patch

diff --git a/libavcodec/fitsdec.c b/libavcodec/fitsdec.c
index 2da79e1ef9..358afd69e8 100644
--- a/libavcodec/fitsdec.c
+++ b/libavcodec/fitsdec.c
@@ -143,7 +143,7 @@  static int fits_read_header(AVCodecContext *avctx, const uint8_t **ptr, FITSHead
 
     size = abs(header->bitpix) >> 3;
     for (i = 0; i < header->naxis; i++) {
-        if (header->naxisn[i] > SIZE_MAX / size) {
+        if (size && header->naxisn[i] > SIZE_MAX / size) {
             av_log(avctx, AV_LOG_ERROR, "unsupported size of FITS image");
             return AVERROR_INVALIDDATA;
         }