[FFmpeg-devel] [PATCH] lavc/avpacket: fill padding area on side data split.

Clément Bœsch ubitux at gmail.com
Sat Jun 1 14:09:47 CEST 2013


The padding data is assumed to be 0 in several places, notably in
subtitles. This problem was not detected with fate-sub-srt test because
the first element of the side data (x1) is 0 in the test, so the
trailing side data present in the packet wasn't read by the decoder. The
issue can be observed with a large enough x1.

It is also noted in FF_INPUT_BUFFER_PADDING_SIZE doxy that MPEG
bitstreams require that padding with 0, so it might fix other issues.
---
 libavcodec/avpacket.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 198365e..2bfb501 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -389,6 +389,7 @@ int av_packet_split_side_data(AVPacket *pkt){
             p-= size+5;
         }
         pkt->size -= 8;
+        memset(pkt->data + pkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
         pkt->side_data_elems = i+1;
         return 1;
     }
-- 
1.8.3



More information about the ffmpeg-devel mailing list