changeset 8396:11b1f7762830 libavcodec

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.
author astrange
date Fri, 19 Dec 2008 01:11:52 +0000
parents 195cba8f6257
children 81c6cec28a62
files h264.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/h264.c	Fri Dec 19 00:44:51 2008 +0000
+++ b/h264.c	Fri Dec 19 01:11:52 2008 +0000
@@ -1406,7 +1406,7 @@
     }
 
     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 @@
         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)