]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/adxdec.c
ffplay: give more meaningful names to the buffersink instances
[ffmpeg] / libavcodec / adxdec.c
index ec4b1041af080dfa2f953c932e92a7d39047e54d..630b79599b2e39ba939f2784f1d6d3ad24b0d2d1 100644 (file)
@@ -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;