]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/pixlet: Fix log(0) check
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 13 Jun 2020 09:21:52 +0000 (11:21 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 14 Jun 2020 16:20:37 +0000 (18:20 +0200)
Fixes: passing zero to clz(), which is not a valid argument
Fixes: 23337/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PIXLET_fuzzer-5179131989065728
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/pixlet.c

index 7b068b1ce53f12ac0ebcd51095e6b3f44b7e6fec..78f571cd5ff9b2f10e6e291139e9c28f1e462b32 100644 (file)
@@ -221,7 +221,7 @@ static int read_high_coeffs(AVCodecContext *avctx, uint8_t *src, int16_t *dst,
     length = 25 - nbits;
 
     while (i < size) {
-        if (state >> 8 != -3)
+        if (((state >> 8) + 3) & 0xFFFFFFF)
             value = ff_clz((state >> 8) + 3) ^ 0x1F;
         else
             value = -1;