[FFmpeg-cvslog] mss2: prevent potential uninitialized reads
Alberto Delmás
git at videolan.org
Mon Nov 12 11:07:52 CET 2012
ffmpeg | branch: master | Alberto Delmás <adelmas at gmail.com> | Sun Nov 11 09:47:39 2012 +0100| [802713c4e7b41bc2deed754d78649945c3442063] | committer: Kostya Shishkov
mss2: prevent potential uninitialized reads
The alternative to zeroing on init is setting the corrupted flag in
all cases where pal_pic is not fully written, at the cost of added
complexity.
Signed-off-by: Kostya Shishkov <kostya.shishkov at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=802713c4e7b41bc2deed754d78649945c3442063
---
libavcodec/mss2.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c
index 5f99b7a..bec3f45 100644
--- a/libavcodec/mss2.c
+++ b/libavcodec/mss2.c
@@ -839,8 +839,8 @@ static av_cold int mss2_decode_init(AVCodecContext *avctx)
if (ret = ff_mss12_decode_init(c, 1, &ctx->sc[0], &ctx->sc[1]))
return ret;
c->pal_stride = c->mask_stride;
- c->pal_pic = av_malloc(c->pal_stride * avctx->height);
- c->last_pal_pic = av_malloc(c->pal_stride * avctx->height);
+ c->pal_pic = av_mallocz(c->pal_stride * avctx->height);
+ c->last_pal_pic = av_mallocz(c->pal_stride * avctx->height);
if (!c->pal_pic || !c->last_pal_pic) {
mss2_decode_end(avctx);
return AVERROR(ENOMEM);
More information about the ffmpeg-cvslog
mailing list