adpcm: Write the correct number of samples for ima-dk4
authorLuca Barbato <lu_zero@gentoo.org>
Sun, 7 Jul 2013 10:56:12 +0000 (12:56 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Fri, 13 Sep 2013 13:50:41 +0000 (15:50 +0200)
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 12576afe206d35231ccd61f9033c5fdab6a11e80)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Conflicts:
libavcodec/adpcm.c

libavcodec/adpcm.c

index a2947329ebf97041dfef9bf13e44f37fa782d8ba..476315c610447ea6ac7d1e74aeed535a32f5656f 100644 (file)
@@ -708,7 +708,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
             src++;
             *samples++ = cs->predictor;
         }
-        for (n = nb_samples >> (1 - st); n > 0; n--, src++) {
+        for (n = (nb_samples >> (1 - st)) - 1; n > 0; n--) {
             uint8_t v = *src;
             *samples++ = adpcm_ima_expand_nibble(&c->status[0 ], v >> 4  , 3);
             *samples++ = adpcm_ima_expand_nibble(&c->status[st], v & 0x0F, 3);