raw demuxer: initialize end of partial packets
authorJanne Grunau <janne-libav@jannau.net>
Sat, 1 Dec 2012 22:42:11 +0000 (23:42 +0100)
committerJanne Grunau <janne-libav@jannau.net>
Tue, 4 Dec 2012 23:02:43 +0000 (00:02 +0100)
libavformat/rawdec.c

index 1c9aabd..5e95d10 100644 (file)
@@ -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;