]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Clear FF_INPUT_BUFFER_PADDING_SIZE bytes at the end of NALs in rbsp_buffer.
authorastrange <astrange@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Fri, 19 Dec 2008 01:11:52 +0000 (01:11 +0000)
committerastrange <astrange@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Fri, 19 Dec 2008 01:11:52 +0000 (01:11 +0000)
Fixes valgrind uninitialized value warnings at the end of decoding H.264
frames.

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@16230 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavcodec/h264.c

index 15587210159b88cd88b4e538323f3f056ef88c1a..4f65d85f32cd5bf0e70dff19ebe4fae962eb5906 100644 (file)
@@ -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)