[FFmpeg-cvslog] truemotion2: clear the token array if its initialization fails.

Michael Niedermayer git at videolan.org
Wed Jan 23 05:29:39 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Jan 23 04:41:41 2013 +0100| [e49c2aab80cb7e6c85642cc4afd0ea471d6ef4b1] | committer: Michael Niedermayer

truemotion2: clear the token array if its initialization fails.

Fixes use of uninitialized and half initialized values, which
can occur on several error pathes

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/truemotion2.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c
index fba02f5..39091dc 100644
--- a/libavcodec/truemotion2.c
+++ b/libavcodec/truemotion2.c
@@ -888,6 +888,8 @@ static int decode_frame(AVCodecContext *avctx,
         t = tm2_read_stream(l, l->buffer + offset, tm2_stream_order[i],
                             buf_size - offset);
         if (t < 0) {
+            int j = tm2_stream_order[i];
+            memset(l->tokens[j], 0, sizeof(**l->tokens) * l->tok_lens[j]);
             return t;
         }
         offset += t;



More information about the ffmpeg-cvslog mailing list