[SCM] libav/experimental: fix uninitialized memory in dnxhd encoder

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:51:25 UTC 2013


The following commit has been merged in the experimental branch:
commit 301a24de52f5baa09beff0958327af2c2a7005dc
Author: Baptiste Coudurier <baptiste.coudurier at gmail.com>
Date:   Fri Sep 18 19:03:05 2009 +0000

    fix uninitialized memory in dnxhd encoder
    
    Originally committed as revision 19912 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 113e8d1..3e68ef2 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -237,6 +237,8 @@ static int dnxhd_write_header(AVCodecContext *avctx, uint8_t *buf)
     DNXHDEncContext *ctx = avctx->priv_data;
     const uint8_t header_prefix[5] = { 0x00,0x00,0x02,0x80,0x01 };
 
+    memset(buf, 0, 640);
+
     memcpy(buf, header_prefix, 5);
     buf[5] = ctx->interlaced ? ctx->cur_field+2 : 0x01;
     buf[6] = 0x80; // crc flag off
@@ -753,6 +755,9 @@ static int dnxhd_encode_picture(AVCodecContext *avctx, unsigned char *buf, int b
 
     avctx->execute(avctx, dnxhd_encode_thread, (void**)&ctx->thread[0], NULL, avctx->thread_count, sizeof(void*));
 
+    assert(640 + offset + 4 <= ctx->cid_table->coding_unit_size);
+    memset(buf + 640 + offset, 0, ctx->cid_table->coding_unit_size - 4 - offset - 640);
+
     AV_WB32(buf + ctx->cid_table->coding_unit_size - 4, 0x600DC0DE); // EOF
 
     if (ctx->interlaced && first_field) {

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list