[FFmpeg-cvslog] Fixed invalid writes in wavpack decoder on corrupted bitstreams.

Laurent Aimar git at videolan.org
Thu Sep 22 01:17:26 CEST 2011


ffmpeg | branch: release/0.8 | Laurent Aimar <fenrir at videolan.org> | Wed Sep  7 22:17:39 2011 +0200| [46d9dd6980bb630a2067ec92e5dd4c46949ed46c] | committer: Anton Khirnov

Fixed invalid writes in wavpack decoder on corrupted bitstreams.

Signed-off-by: Martin Storsjö <martin at martin.st>
(cherry picked from commit 0aedab03405849962b469277afe047aa2c61a87f)

Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=46d9dd6980bb630a2067ec92e5dd4c46949ed46c
---

 libavcodec/wavpack.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 64725c7..5bd677e 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -1113,7 +1113,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
             int16_t *dst = (int16_t*)samples + 1;
             int16_t *src = (int16_t*)samples;
             int cnt = samplecount;
-            while(cnt--){
+            while(cnt-- > 0){
                 *dst = *src;
                 src += channel_stride;
                 dst += channel_stride;
@@ -1122,7 +1122,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
             int32_t *dst = (int32_t*)samples + 1;
             int32_t *src = (int32_t*)samples;
             int cnt = samplecount;
-            while(cnt--){
+            while(cnt-- > 0){
                 *dst = *src;
                 src += channel_stride;
                 dst += channel_stride;
@@ -1131,7 +1131,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
             float *dst = (float*)samples + 1;
             float *src = (float*)samples;
             int cnt = samplecount;
-            while(cnt--){
+            while(cnt-- > 0){
                 *dst = *src;
                 src += channel_stride;
                 dst += channel_stride;



More information about the ffmpeg-cvslog mailing list