Commit cc24665f authored by Paul B Mahol's avatar Paul B Mahol

avcodec/scpr: make sure count and min are valid

parent 70a70871
......@@ -529,7 +529,7 @@ static int decompress_p(AVCodecContext *avctx,
return ret;
max += temp << 8;
if (min > max)
if (min > max || min >= s->nbcount)
return AVERROR_INVALIDDATA;
memset(s->blocks, 0, sizeof(*s->blocks) * s->nbcount);
......@@ -541,6 +541,8 @@ static int decompress_p(AVCodecContext *avctx,
ret |= decode_value(s, s->count_model, 256, 20, &count);
if (ret < 0)
return ret;
if (count <= 0)
return AVERROR_INVALIDDATA;
while (min < s->nbcount && count-- > 0) {
s->blocks[min++] = fill;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment