summaryrefslogtreecommitdiff
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorAlexander Strange <astrange@ithinksw.com>2008-12-19 01:11:52 +0000
committerAlexander Strange <astrange@ithinksw.com>2008-12-19 01:11:52 +0000
commitd43696309a64a19e2e738f9e7aa94f6c96409aee (patch)
tree9972c8bae1ef9976fa7fda0c0daa8437ae04dc57 /libavcodec/h264.c
parent1ca610c0152f31847ab760fda1fb147692f31e7e (diff)
Clear FF_INPUT_BUFFER_PADDING_SIZE bytes at the end of NALs in rbsp_buffer.
Fixes valgrind uninitialized value warnings at the end of decoding H.264 frames. Originally committed as revision 16230 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 1558721015..4f65d85f32 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1406,7 +1406,7 @@ static const uint8_t *decode_nal(H264Context *h, const uint8_t *src, int *dst_le
}
bufidx = h->nal_unit_type == NAL_DPC ? 1 : 0; // use second escape buffer for inter data
- h->rbsp_buffer[bufidx]= av_fast_realloc(h->rbsp_buffer[bufidx], &h->rbsp_buffer_size[bufidx], length);
+ h->rbsp_buffer[bufidx]= av_fast_realloc(h->rbsp_buffer[bufidx], &h->rbsp_buffer_size[bufidx], length+FF_INPUT_BUFFER_PADDING_SIZE);
dst= h->rbsp_buffer[bufidx];
if (dst == NULL){
@@ -1430,6 +1430,8 @@ static const uint8_t *decode_nal(H264Context *h, const uint8_t *src, int *dst_le
dst[di++]= src[si++];
}
+ memset(dst+di, 0, FF_INPUT_BUFFER_PADDING_SIZE);
+
*dst_length= di;
*consumed= si + 1;//+1 for the header
//FIXME store exact number of bits in the getbitcontext (it is needed for decoding)