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.
Unified · Split
| @@ -839,8 +839,8 @@ static av_cold int mss2_decode_init(AVCodecContext *avctx) · 838 unmodified lines | ||
| 839 | 839 | if (ret = ff_mss12_decode_init(c, 1, &ctx->sc[0], &ctx->sc[1])) |
| 840 | 840 | return ret; |
| 841 | 841 | 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); | |
| 844 | 844 | if (!c->pal_pic || !c->last_pal_pic) { |
| 845 | 845 | mss2_decode_end(avctx); |
| 846 | 846 | return AVERROR(ENOMEM); |