From 8a56ac7b8903370ea56477bb4076eabc7f0d2ac1 Mon Sep 17 00:00:00 2001 From: Fabrice Bellard Date: Tue, 9 Dec 2003 15:34:44 +0000 Subject: [PATCH] copy packet without omitting the padding Originally committed as revision 2584 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/utils.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 7cbb1a0246..7100798266 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -167,12 +167,14 @@ int av_dup_packet(AVPacket *pkt) { if (pkt->destruct != av_destruct_packet) { uint8_t *data; - /* we duplicate the packet */ - data = av_malloc(pkt->size); + /* we duplicate the packet and don't forget to put the padding + again */ + data = av_malloc(pkt->size + FF_INPUT_BUFFER_PADDING_SIZE); if (!data) { return AVERROR_NOMEM; } memcpy(data, pkt->data, pkt->size); + memset(data + pkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE); pkt->data = data; pkt->destruct = av_destruct_packet; }