History

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.

Alberto Delmás committed 14 years ago

Commit 802713c1 parent 6d933081 file · +2 −2Browse files

Unified · Split

libavcodec/mss2.c+2−2
@@ -839,8 +839,8 @@ static av_cold int mss2_decode_init(AVCodecContext *avctx) · 838 unmodified lines
839839 if (ret = ff_mss12_decode_init(c, 1, &ctx->sc[0], &ctx->sc[1]))
840840 return ret;
841841 c->pal_stride = c->mask_stride;
842− c->pal_pic = av_malloc(c->pal_stride * avctx->height);
843− c->last_pal_pic = av_malloc(c->pal_stride * avctx->height);
842+ c->pal_pic = av_mallocz(c->pal_stride * avctx->height);
843+ c->last_pal_pic = av_mallocz(c->pal_stride * avctx->height);
844844 if (!c->pal_pic || !c->last_pal_pic) {
845845 mss2_decode_end(avctx);
846846 return AVERROR(ENOMEM);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t