diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2011-10-11 13:17:44 -0400 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2011-10-28 11:47:27 -0400 |
commit | 2cab5784892c6ae47feb5f1a97445946b3404ac0 (patch) | |
tree | 4624649afbd9946810a043ef49ca21786089aeee | |
parent | b7e514575982fd2f5db5ea4f3b466d6dd6a08aa7 (diff) | |
download | ffmpeg-2cab5784892c6ae47feb5f1a97445946b3404ac0.tar.gz |
apedec: use unsigned int for 'nblocks' and make sure that it's within int range
-rw-r--r-- | libavcodec/apedec.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c index a741c7d469..f6ec47039d 100644 --- a/libavcodec/apedec.c +++ b/libavcodec/apedec.c @@ -812,7 +812,7 @@ static int ape_decode_frame(AVCodecContext *avctx, int buf_size = avpkt->size; APEContext *s = avctx->priv_data; int16_t *samples = data; - int nblocks; + uint32_t nblocks; int i, n; int blockstodecode; int bytes_used; @@ -843,9 +843,9 @@ static int ape_decode_frame(AVCodecContext *avctx, s->currentframeblocks = nblocks; buf += 4; - if (nblocks <= 0) { - *data_size = 0; - return buf_size; + if (!nblocks || nblocks > INT_MAX) { + av_log(avctx, AV_LOG_ERROR, "Invalid sample count: %u.\n", nblocks); + return AVERROR_INVALIDDATA; } s->samples = nblocks; |