summaryrefslogtreecommitdiff
path: root/libavcodec/adpcm.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-12-12 17:14:32 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-12-12 17:46:05 +0100
commitf18c873ab5ee3c78d00fdcc2582b39c133faecb4 (patch)
treed1fff7c7706709f7b8421290ca52f054de5e3146 /libavcodec/adpcm.c
parent03b9d4a7dc7cb399587b6148617cef59b36b3a4b (diff)
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>
Diffstat (limited to 'libavcodec/adpcm.c')
-rw-r--r--libavcodec/adpcm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index bf26186d33..cd68257256 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -801,7 +801,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);