aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-01-06 19:03:17 +0100
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-01-27 23:45:45 +0100
commit4679e543880ae6f316e00f480ca5a79f33eb1dc9 (patch)
treef9d05e7129c7bb18ca9bdc65f2babad001f7ca90
parent782257ba66e0b0f4b6fa006a5ca059773478ccf5 (diff)
downloadffmpeg-4679e543880ae6f316e00f480ca5a79f33eb1dc9.tar.gz
asfdec_o: make sure packet_size is non-zero before seeking
This fixes infinite loops due to seeking back. Reviewed-by: Alexandra Hájková <alexandra.khirnova@gmail.com> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> (cherry picked from commit 3776a72962b0622af17c4aef89a831da2cbaceca) Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
-rw-r--r--libavformat/asfdec_o.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/asfdec_o.c b/libavformat/asfdec_o.c
index 798f159b21..2b3d9e6de5 100644
--- a/libavformat/asfdec_o.c
+++ b/libavformat/asfdec_o.c
@@ -1287,6 +1287,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);