4xm: check for invalid zero ac coeffs
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 29 Jun 2013 23:28:25 +0000 (01:28 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 29 Jun 2013 23:35:22 +0000 (01:35 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/4xm.c

index 3e0e681..dc84e96 100644 (file)
@@ -525,7 +525,12 @@ static int decode_i_block(FourXContext *f, int16_t *block)
         if (code == 0xf0) {
             i += 16;
         } else {
-            level = get_xbits(&f->gb, code & 0xf);
+            if (code & 0xf) {
+                level = get_xbits(&f->gb, code & 0xf);
+            } else {
+                av_log(f->avctx, AV_LOG_ERROR, "0 coeff\n");
+                return AVERROR_INVALIDDATA;
+            }
             i    += code >> 4;
             if (i >= 64) {
                 av_log(f->avctx, AV_LOG_ERROR, "run %d oveflow\n", i);