[FFmpeg-devel] [PATCH 1/2] avformat/mov: check result of avio_seek

Zhang Rui bbcallen at gmail.com
Thu May 21 05:48:55 CEST 2015


---
 libavformat/mov.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 085d2a7..bfbf599 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4229,7 +4229,10 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
         mov->found_mdat = 0;
         if (!mov->next_root_atom)
             return AVERROR_EOF;
-        avio_seek(s->pb, mov->next_root_atom, SEEK_SET);
+        if (avio_seek(s->pb, mov->next_root_atom, SEEK_SET) != mov->next_root_atom) {
+            av_log(mov->fc, AV_LOG_ERROR, "next root atom offset 0x%"PRIx64": partial file\n", mov->next_root_atom);
+            return AVERROR_INVALIDDATA;
+        }
         mov->next_root_atom = 0;
         if (mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX }) < 0 ||
             avio_feof(s->pb))
-- 
2.0.0



More information about the ffmpeg-devel mailing list