aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-09-30 08:50:41 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-11-11 20:18:48 +0100
commitdf8caf9a761898881c9ee36423ee3fb4033a65da (patch)
tree23ce7a5e0b814ce9b18396688f370eaac1302eab
parent3d55f7782db375add5a1f21dbd3ab46034c556a9 (diff)
downloadffmpeg-df8caf9a761898881c9ee36423ee3fb4033a65da.tar.gz
avcodec/fitsdec: Fail on 0 naxisn
Fixes: Timeout (100+ sec -> 23ms) Fixes: 17769/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FITS_fuzzer-5678314672357376 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 4a3303d52096337dc109fbd523ecb4b46cddace1) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/fitsdec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/fitsdec.c b/libavcodec/fitsdec.c
index a20b8faf9e..1f06754f8b 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 (size && header->naxisn[i] > SIZE_MAX / size) {
+ if (size == 0 || header->naxisn[i] > SIZE_MAX / size) {
av_log(avctx, AV_LOG_ERROR, "unsupported size of FITS image");
return AVERROR_INVALIDDATA;
}