Module: libav Branch: release/11 Commit: e9602aa5056693aa545e470c590d09df8395df37
Author: Luca Barbato <[email protected]> Committer: Luca Barbato <[email protected]> Date: Sun Nov 1 04:07:48 2015 +0100 flashsv: Initialize the block array Otherwise flashsv2_prime could be fed random data. Bug-Id: 908 CC: [email protected] Signed-off-by: Luca Barbato <[email protected]> --- libavcodec/flashsv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c index de7979c..54295f4 100644 --- a/libavcodec/flashsv.c +++ b/libavcodec/flashsv.c @@ -339,12 +339,14 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data, s->is_keyframe = (avpkt->flags & AV_PKT_FLAG_KEY) && (s->ver == 2); if (s->is_keyframe) { int err; + int nb_blocks = (v_blocks + !!v_part) * + (h_blocks + !!h_part) * sizeof(s->blocks[0]); if ((err = av_reallocp(&s->keyframedata, avpkt->size)) < 0) return err; memcpy(s->keyframedata, avpkt->data, avpkt->size); - if ((err = av_reallocp(&s->blocks, (v_blocks + !!v_part) * - (h_blocks + !!h_part) * sizeof(s->blocks[0]))) < 0) + if ((err = av_reallocp(&s->blocks, nb_blocks)) < 0) return err; + memset(s->blocks, 0, nb_blocks); } av_dlog(avctx, "image: %dx%d block: %dx%d num: %dx%d part: %dx%d\n", _______________________________________________ libav-commits mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-commits
