avcodec/dxv: Subtract 12 earlier in dxv_decompress_cocg()
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 24 Sep 2019 10:40:35 +0000 (12:40 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 8 Oct 2019 14:24:58 +0000 (16:24 +0200)
the data_start is after reading 12 bytes and if its subtracted
at the very end the intermediate might overflow

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/dxv.c

index df63006..b51d639 100644 (file)
@@ -783,7 +783,7 @@ static int dxv_decompress_cocg(DXVContext *ctx, GetByteContext *gb,
             return ret;
     }
 
-    bytestream2_seek(gb, data_start + op_offset + skip0 + skip1 - 12, SEEK_SET);
+    bytestream2_seek(gb, data_start - 12 + op_offset + skip0 + skip1, SEEK_SET);
 
     return 0;
 }