aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-12-12 17:14:32 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-07 01:00:02 +0100
commit85a14dbd5dca34320f58b1ba11dd6dd0df4fb3be (patch)
treef09d7cabed187035a31e34fbcb117876d2e624c7
parentdb0f7f7394e1f994ed38db043f78ed0f10bde0da (diff)
downloadffmpeg-85a14dbd5dca34320f58b1ba11dd6dd0df4fb3be.tar.gz
adpcm: fix off by 1 error and out of array access in DK4
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit f18c873ab5ee3c78d00fdcc2582b39c133faecb4) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/adpcm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index c779f8b572..683a231f26 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -755,7 +755,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR_INVALIDDATA;
}
}
- for (n = nb_samples >> (1 - st); n > 0; n--) {
+ for (n = (nb_samples - 1) >> (1 - st); n > 0; n--) {
int v = bytestream2_get_byteu(&gb);
*samples++ = adpcm_ima_expand_nibble(&c->status[0 ], v >> 4 , 3);
*samples++ = adpcm_ima_expand_nibble(&c->status[st], v & 0x0F, 3);