diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c index e28a6ba724..03e8270463 100644 --- a/libavcodec/dxv.c +++ b/libavcodec/dxv.c @@ -743,7 +743,7 @@ static int dxv_decompress_cocg(DXVContext *ctx, GetByteContext *gb, int skip0, skip1, oi0 = 0, oi1 = 0; int ret, state0 = 0, state1 = 0; - if (op_offset < 12) + if (op_offset < 12 || op_offset - 12 > bytestream2_get_bytes_left(gb)) return AVERROR_INVALIDDATA; dst = tex_data;