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

Laurent Aimar git at videolan.org
Sun Dec 25 01:35:59 CET 2011


ffmpeg | branch: release/0.6 | Laurent Aimar <fenrir at videolan.org> | Wed Sep  7 22:17:39 2011 +0200| [f5a8c4242eda7a41d8c93d9ddf352cb31830b06b] | committer: Reinhard Tartler

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>
(cherry picked from commit 685940da4c843beb9283a21718cbd2fa4fa5d796)

Conflicts:

	libavcodec/wavpack.c

Signed-off-by: Reinhard Tartler <siretart at tauware.de>

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

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

diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 906ccea..968ffa6 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -1009,7 +1009,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx,
             int16_t *dst = (int16_t*)samples + samplecount * 2;
             int16_t *src = (int16_t*)samples + samplecount;
             int cnt = samplecount;
-            while(cnt--){
+            while(cnt-- > 0){
                 *--dst = *--src;
                 *--dst = *src;
             }
@@ -1018,7 +1018,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx,
             int32_t *dst = (int32_t*)samples + samplecount * 2;
             int32_t *src = (int32_t*)samples + samplecount;
             int cnt = samplecount;
-            while(cnt--){
+            while(cnt-- > 0){
                 *--dst = *--src;
                 *--dst = *src;
             }
@@ -1027,7 +1027,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx,
             float *dst = (float*)samples + samplecount * 2;
             float *src = (float*)samples + samplecount;
             int cnt = samplecount;
-            while(cnt--){
+            while(cnt-- > 0){
                 *--dst = *--src;
                 *--dst = *src;
             }



More information about the ffmpeg-cvslog mailing list