[FFmpeg-cvslog] avcodec/huffyuvdec: clear remainder of the array on end of input in decode_422_bitstream()

Michael Niedermayer git at videolan.org
Fri Dec 27 01:28:36 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Dec 27 00:23:10 2013 +0100| [42b6805cc1989f759f19e9d253527311741cbd3a] | committer: Michael Niedermayer

avcodec/huffyuvdec: clear remainder of the array on end of input in decode_422_bitstream()

Fixes: msan_uninit-mem_7f909423efcd_9923_yuv_predmed.avi
Fixes use of uninitialized memory
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=42b6805cc1989f759f19e9d253527311741cbd3a
---

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

diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index 3cfda9b..cbb41fa 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -406,6 +406,9 @@ static void decode_422_bitstream(HYuvContext *s, int count)
             READ_2PIX(s->temp[0][2 * i    ], s->temp[1][i], 1);
             READ_2PIX(s->temp[0][2 * i + 1], s->temp[2][i], 2);
         }
+        for (; i < count; i++)
+            s->temp[0][2 * i    ] = s->temp[1][i] =
+            s->temp[0][2 * i + 1] = s->temp[2][i] = 128;
     } else {
         for (i = 0; i < count; i++) {
             READ_2PIX(s->temp[0][2 * i    ], s->temp[1][i], 1);



More information about the ffmpeg-cvslog mailing list