[FFmpeg-cvslog] zmbv: avoid use of uninitialized data

Michael Niedermayer git at videolan.org
Thu Nov 15 21:03:44 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Nov 15 19:15:35 2012 +0100| [e31b1938acbe8bd9c5e1dc4be674601ec6823bcf] | committer: Michael Niedermayer

zmbv: avoid use of uninitialized data

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=e31b1938acbe8bd9c5e1dc4be674601ec6823bcf
---

 libavcodec/zmbv.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c
index 8727bfc..1b94351 100644
--- a/libavcodec/zmbv.c
+++ b/libavcodec/zmbv.c
@@ -493,6 +493,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
         c->by = (c->height+ c->bh - 1) / c->bh;
         if (!c->cur || !c->prev)
             return -1;
+        memset(c->cur, 0, avctx->width * avctx->height * (c->bpp / 8));
+        memset(c->prev, 0, avctx->width * avctx->height * (c->bpp / 8));
         c->decode_intra= decode_intra;
     }
 
@@ -633,7 +635,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
     /* Allocate decompression buffer */
     if (c->decomp_size) {
-        if ((c->decomp_buf = av_malloc(c->decomp_size)) == NULL) {
+        if ((c->decomp_buf = av_mallocz(c->decomp_size)) == NULL) {
             av_log(avctx, AV_LOG_ERROR,
                    "Can't allocate decompression buffer.\n");
             return AVERROR(ENOMEM);



More information about the ffmpeg-cvslog mailing list