changeset 10186:f01415f3f9a8 libavcodec

fix uninitialized memory in dnxhd encoder
author bcoudurier
date Fri, 18 Sep 2009 19:03:05 +0000
parents 25752b5ce17a
children b14d646fe719
files dnxhdenc.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dnxhdenc.c	Thu Sep 17 18:52:11 2009 +0000
+++ b/dnxhdenc.c	Fri Sep 18 19:03:05 2009 +0000
@@ -237,6 +237,8 @@
     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 @@
 
     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) {