Mercurial > libavcodec.hg
comparison dnxhdenc.c @ 10186:f01415f3f9a8 libavcodec
fix uninitialized memory in dnxhd encoder
author | bcoudurier |
---|---|
date | Fri, 18 Sep 2009 19:03:05 +0000 |
parents | 38cfe222e1a4 |
children | 97f38ca4ed14 |
comparison
equal
deleted
inserted
replaced
10185:25752b5ce17a | 10186:f01415f3f9a8 |
---|---|
235 static int dnxhd_write_header(AVCodecContext *avctx, uint8_t *buf) | 235 static int dnxhd_write_header(AVCodecContext *avctx, uint8_t *buf) |
236 { | 236 { |
237 DNXHDEncContext *ctx = avctx->priv_data; | 237 DNXHDEncContext *ctx = avctx->priv_data; |
238 const uint8_t header_prefix[5] = { 0x00,0x00,0x02,0x80,0x01 }; | 238 const uint8_t header_prefix[5] = { 0x00,0x00,0x02,0x80,0x01 }; |
239 | 239 |
240 memset(buf, 0, 640); | |
241 | |
240 memcpy(buf, header_prefix, 5); | 242 memcpy(buf, header_prefix, 5); |
241 buf[5] = ctx->interlaced ? ctx->cur_field+2 : 0x01; | 243 buf[5] = ctx->interlaced ? ctx->cur_field+2 : 0x01; |
242 buf[6] = 0x80; // crc flag off | 244 buf[6] = 0x80; // crc flag off |
243 buf[7] = 0xa0; // reserved | 245 buf[7] = 0xa0; // reserved |
244 AV_WB16(buf + 0x18, avctx->height); // ALPF | 246 AV_WB16(buf + 0x18, avctx->height); // ALPF |
751 assert(!(ctx->slice_size[i] & 3)); | 753 assert(!(ctx->slice_size[i] & 3)); |
752 } | 754 } |
753 | 755 |
754 avctx->execute(avctx, dnxhd_encode_thread, (void**)&ctx->thread[0], NULL, avctx->thread_count, sizeof(void*)); | 756 avctx->execute(avctx, dnxhd_encode_thread, (void**)&ctx->thread[0], NULL, avctx->thread_count, sizeof(void*)); |
755 | 757 |
758 assert(640 + offset + 4 <= ctx->cid_table->coding_unit_size); | |
759 memset(buf + 640 + offset, 0, ctx->cid_table->coding_unit_size - 4 - offset - 640); | |
760 | |
756 AV_WB32(buf + ctx->cid_table->coding_unit_size - 4, 0x600DC0DE); // EOF | 761 AV_WB32(buf + ctx->cid_table->coding_unit_size - 4, 0x600DC0DE); // EOF |
757 | 762 |
758 if (ctx->interlaced && first_field) { | 763 if (ctx->interlaced && first_field) { |
759 first_field = 0; | 764 first_field = 0; |
760 ctx->cur_field ^= 1; | 765 ctx->cur_field ^= 1; |