# HG changeset patch # User reimar # Date 1254251838 0 # Node ID 44f31c1c9accbeee16ab0b557431b8192fa6ee8f # Parent 9e43db5ad7ef299cd50ea0776a282b0941a919ac Make sure that dv encoder initializes all encoded packet data. The specification does not say which value to use for unused parts, so fill all unused bytes with 0xff, which is consistent with what DV usually uses for reserved or unused parts. diff -r 9e43db5ad7ef -r 44f31c1c9acc dv.c --- a/dv.c Tue Sep 29 18:03:30 2009 +0000 +++ b/dv.c Tue Sep 29 19:17:18 2009 +0000 @@ -1102,8 +1102,17 @@ av_log(NULL, AV_LOG_ERROR, "ac bitstream overflow\n"); } - for (j=0; j<5*s->sys->bpm; j++) + for (j=0; j<5*s->sys->bpm; j++) { + int pos; + int size = pbs[j].size_in_bits >> 3; flush_put_bits(&pbs[j]); + pos = put_bits_count(&pbs[j]) >> 3; + if (pos > size) { + av_log(avctx, AV_LOG_ERROR, "bitstream written beyond buffer size\n"); + return -1; + } + memset(pbs[j].buf + pos, 0xff, size - pos); + } return 0; }