Browse Source

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@gmail.com>
tags/n1.1
Alberto Delmás Kostya Shishkov 13 years ago
parent
commit
802713c4e7
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      libavcodec/mss2.c

+ 2
- 2
libavcodec/mss2.c View File

@@ -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);


Loading…
Cancel
Save