]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/wmadec: Require previous exponents for reuse
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 31 Oct 2019 13:38:16 +0000 (14:38 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 20 Nov 2019 14:50:15 +0000 (15:50 +0100)
Fixes: division by zero
Fixes: 18474/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAV2_fuzzer-5764986962182144
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/wma.h
libavcodec/wmadec.c

index 325f03c44b7ad3d0ab83f71abc2f8cb81b05d0dc..8344cb5b93738cc97c5c81d9a2b327a0bfa84d84 100644 (file)
@@ -123,6 +123,7 @@ typedef struct WMACodecContext {
     uint8_t last_superframe[MAX_CODED_SUPERFRAME_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; /* padding added */
     int last_bitoffset;
     int last_superframe_len;
+    int exponents_initialized;
     float noise_table[NOISE_TAB_SIZE];
     int noise_index;
     float noise_mult; /* XXX: suppress that and integrate it in the noise array */
index 78b51e5871bf8c685f9eb7524025cdc738014a4e..bb9bc8d2367d3c67962a03f74617a444385ce241 100644 (file)
@@ -587,6 +587,9 @@ static int wma_decode_block(WMACodecContext *s)
                 s->exponents_bsize[ch] = bsize;
             }
         }
+        s->exponents_initialized = 1;
+    }else if (!s->exponents_initialized) {
+        return AVERROR_INVALIDDATA;
     }
 
     /* parse spectral coefficients : just RLE encoding */