diff options
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/dv.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libavcodec/dv.c b/libavcodec/dv.c index 078c30dbb6..b17bbc7074 100644 --- a/libavcodec/dv.c +++ b/libavcodec/dv.c @@ -1102,8 +1102,17 @@ static int dv_encode_video_segment(AVCodecContext *avctx, void *arg) 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; } |