summaryrefslogtreecommitdiff
path: root/libavcodec/dv.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-09-29 19:17:18 +0000
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-09-29 19:17:18 +0000
commitebb651d5f2593836f95d4f1737ff1ee722fd98f4 (patch)
treedc788175bbd8ec7c2b1f619d55ca4f776caca0a3 /libavcodec/dv.c
parent8a8720c1bb2ea4e84517444a685c1eecad598d05 (diff)
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. Originally committed as revision 20084 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/dv.c')
-rw-r--r--libavcodec/dv.c11
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;
}