apedec: use unsigned int for 'nblocks' and make sure that it's within int range
This commit is contained in:
parent
b7e5145759
commit
2cab578489
@ -812,7 +812,7 @@ static int ape_decode_frame(AVCodecContext *avctx,
|
|||||||
int buf_size = avpkt->size;
|
int buf_size = avpkt->size;
|
||||||
APEContext *s = avctx->priv_data;
|
APEContext *s = avctx->priv_data;
|
||||||
int16_t *samples = data;
|
int16_t *samples = data;
|
||||||
int nblocks;
|
uint32_t nblocks;
|
||||||
int i, n;
|
int i, n;
|
||||||
int blockstodecode;
|
int blockstodecode;
|
||||||
int bytes_used;
|
int bytes_used;
|
||||||
@ -843,9 +843,9 @@ static int ape_decode_frame(AVCodecContext *avctx,
|
|||||||
|
|
||||||
s->currentframeblocks = nblocks;
|
s->currentframeblocks = nblocks;
|
||||||
buf += 4;
|
buf += 4;
|
||||||
if (nblocks <= 0) {
|
if (!nblocks || nblocks > INT_MAX) {
|
||||||
*data_size = 0;
|
av_log(avctx, AV_LOG_ERROR, "Invalid sample count: %u.\n", nblocks);
|
||||||
return buf_size;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
s->samples = nblocks;
|
s->samples = nblocks;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user