summaryrefslogtreecommitdiffstats
path: root/libavcodec/adxdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-04-16 01:57:36 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-04-16 02:18:10 +0200
commit8dfb13ea59f87365f407dfe4fc196b50e3fad92b (patch)
treecb0fd3f80c10a75e96281cb62ff3953e3f9127a8 /libavcodec/adxdec.c
parent6d24fe2c3c7437bfbf8317d3de5bdd4af9823589 (diff)
downloadffmpeg-streaming-8dfb13ea59f87365f407dfe4fc196b50e3fad92b.zip
ffmpeg-streaming-8dfb13ea59f87365f407dfe4fc196b50e3fad92b.tar.gz
adxdec: Check available space before decoding block.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/adxdec.c')
-rw-r--r--libavcodec/adxdec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/adxdec.c b/libavcodec/adxdec.c
index ec4b104..630b795 100644
--- a/libavcodec/adxdec.c
+++ b/libavcodec/adxdec.c
@@ -100,6 +100,7 @@ static int adx_decode_frame(AVCodecContext *avctx, void *data,
ADXContext *c = avctx->priv_data;
int16_t *samples;
const uint8_t *buf = avpkt->data;
+ const uint8_t *buf_end = buf + avpkt->size;
int num_blocks, ch, ret;
if (c->eof) {
@@ -148,7 +149,7 @@ static int adx_decode_frame(AVCodecContext *avctx, void *data,
while (num_blocks--) {
for (ch = 0; ch < c->channels; ch++) {
- if (adx_decode(c, samples + ch, buf, ch)) {
+ if (buf_end - buf < BLOCK_SIZE || adx_decode(c, samples + ch, buf, ch)) {
c->eof = 1;
buf = avpkt->data + avpkt->size;
break;
OpenPOWER on IntegriCloud