[FFmpeg-cvslog] avcodec/wmalosslessdec: shrink output on error so no uninitialized data is returned

Michael Niedermayer git at videolan.org
Mon Jan 13 17:28:57 CET 2014


ffmpeg | branch: release/2.1 | Michael Niedermayer <michaelni at gmx.at> | Sat Jan 11 02:04:01 2014 +0100| [57824d1ba6174a44668ff333318ab58bd8fbd8f3] | committer: Michael Niedermayer

avcodec/wmalosslessdec: shrink output on error so no uninitialized data is returned

Fixes use of uninitialized memory
partly fixes: msan_uninit-mem_7f7834b6a530_6473_luckynight-partial.wma
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 6b18a6839b43ea78e70cd3e35f781d1c955bda73)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/wmalosslessdec.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 8487af9..86ca588 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -1076,8 +1076,11 @@ static int decode_frame(WmallDecodeCtx *s)
 
     /* decode all subframes */
     while (!s->parsed_all_subframes) {
+        int decoded_samples = s->channel[0].decoded_samples;
         if (decode_subframe(s) < 0) {
             s->packet_loss = 1;
+            if (s->frame->nb_samples)
+                s->frame->nb_samples = decoded_samples;
             return 0;
         }
     }



More information about the ffmpeg-cvslog mailing list