Module: libav
Branch: master
Commit: 2e6ba1993ef41af4a224e854077e4ba4d30f246b

Author:    Andreas Cadhalpun <[email protected]>
Committer: Luca Barbato <[email protected]>
Date:      Thu Jan  7 10:02:53 2016 +0100

asfdec: make sure packet_size is non-zero before seeking

This fixes infinite loops due to seeking back.

Signed-off-by: Alexandra Hájková <[email protected]>
Signed-off-by: Luca Barbato <[email protected]>

---

 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);

_______________________________________________
libav-commits mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-commits

Reply via email to