diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-09-13 01:14:44 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-09-13 01:27:35 +0200 |
commit | d67e74929c2c0d09383c2f4a9c904bfdd839c67c (patch) | |
tree | 7f244ff2c59412d42c54bd057a7a55c424aa6d5f /libavcodec/smacker.c | |
parent | 32c0c562e7f2102f4123334ef388224cdd072d3b (diff) | |
download | ffmpeg-d67e74929c2c0d09383c2f4a9c904bfdd839c67c.tar.gz |
smacker: fix a few off by 1 errors
stereo & 16bit is untested due to lack of samples
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/smacker.c')
-rw-r--r-- | libavcodec/smacker.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index 851f222693..3a4ba1a114 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -625,9 +625,9 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, int *data_size, if(bits) { //decode 16-bit data for(i = stereo; i >= 0; i--) pred[i] = av_bswap16(get_bits(&gb, 16)); - for(i = 0; i < stereo; i++) + for(i = 0; i <= stereo; i++) *samples++ = pred[i]; - for(i = 0; i < unp_size / 2; i++) { + for(; i < unp_size / 2; i++) { if(i & stereo) { if(vlc[2].table) res = get_vlc2(&gb, vlc[2].table, SMKTREE_BITS, 3); @@ -659,11 +659,9 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, int *data_size, } else { //8-bit data for(i = stereo; i >= 0; i--) pred[i] = get_bits(&gb, 8); - if (stereo + unp_size > *data_size) - return -1; - for(i = 0; i < stereo; i++) + for(i = 0; i <= stereo; i++) *samples8++ = pred[i]; - for(i = 0; i < unp_size; i++) { + for(; i < unp_size; i++) { if(i & stereo){ if(vlc[1].table) res = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3); |