changeset 5739:84bfac703b3a libavformat

Properly pad H.264 extradata when taken from fmtp SDP attributes This fixes some valgrind warnings.
author mstorsjo
date Wed, 03 Mar 2010 21:00:50 +0000
parents 7152149eb03f
children 421297d526d0
files rtpdec_h264.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rtpdec_h264.c	Wed Mar 03 17:31:24 2010 +0000
+++ b/rtpdec_h264.c	Wed Mar 03 21:00:50 2010 +0000
@@ -134,7 +134,9 @@
 
             packet_size= av_base64_decode(decoded_packet, base64packet, sizeof(decoded_packet));
             if (packet_size) {
-                uint8_t *dest= av_malloc(packet_size+sizeof(start_sequence)+codec->extradata_size);
+                uint8_t *dest = av_malloc(packet_size + sizeof(start_sequence) +
+                                         codec->extradata_size +
+                                         FF_INPUT_BUFFER_PADDING_SIZE);
                 if(dest)
                 {
                     if(codec->extradata_size)
@@ -146,6 +148,8 @@
 
                     memcpy(dest+codec->extradata_size, start_sequence, sizeof(start_sequence));
                     memcpy(dest+codec->extradata_size+sizeof(start_sequence), decoded_packet, packet_size);
+                    memset(dest+codec->extradata_size+sizeof(start_sequence)+
+                           packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
 
                     codec->extradata= dest;
                     codec->extradata_size+= sizeof(start_sequence)+packet_size;