From 54c7fe6d68444cc3c5d4fdda2f2126ed79eac855 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Sat, 1 Dec 2012 23:42:11 +0100 Subject: raw demuxer: initialize end of partial packets --- libavformat/rawdec.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libavformat/rawdec.c') diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c index 1c9aabd6fd..5e95d10efd 100644 --- a/libavformat/rawdec.c +++ b/libavformat/rawdec.c @@ -45,6 +45,10 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt) if (ret < 0) { av_free_packet(pkt); return ret; + } else if (ret < size) { + /* initialize end of packet for partial reads to avoid reading + * uninitialized data on allowed overreads */ + memset(pkt->data + ret, 0, FF_INPUT_BUFFER_PADDING_SIZE); } pkt->size = ret; return ret; -- cgit v1.2.3