[FFmpeg-cvslog] asfdec: make sure packet_size is non-zero before seeking

Andreas Cadhalpun git at videolan.org
Tue Feb 16 18:38:06 CET 2016


ffmpeg | branch: master | Andreas Cadhalpun <andreas.cadhalpun at googlemail.com> | Thu Jan  7 10:02:53 2016 +0100| [2e6ba1993ef41af4a224e854077e4ba4d30f246b] | committer: Luca Barbato

asfdec: make sure packet_size is non-zero before seeking

This fixes infinite loops due to seeking back.

Signed-off-by: Alexandra Hájková <alexandra at khirnov.net>
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2e6ba1993ef41af4a224e854077e4ba4d30f246b
---

 libavformat/asfdec.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index cbab9a2..85d3266 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -1291,6 +1291,10 @@ static int asf_read_payload(AVFormatContext *s, AVPacket *pkt)
         }
         if (!asf_pkt) {
             if (asf->packet_offset + asf->packet_size <= asf->data_offset + asf->data_size) {
+                if (!asf->packet_size) {
+                    av_log(s, AV_LOG_ERROR, "Invalid packet size 0.\n");
+                    return AVERROR_INVALIDDATA;
+                }
                 avio_seek(pb, asf->packet_offset + asf->packet_size, SEEK_SET);
                 av_log(s, AV_LOG_WARNING, "Skipping the stream with the invalid stream index %d.\n",
                        asf->stream_index);



More information about the ffmpeg-cvslog mailing list