avformat/id3v2: Use ffio_ensure_seekback() in id3v2_read_internal()
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 19 May 2017 18:54:03 +0000 (20:54 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 19 May 2017 19:14:26 +0000 (21:14 +0200)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/id3v2.c

index f7fa3ef..0534635 100644 (file)
@@ -1072,7 +1072,9 @@ static void id3v2_read_internal(AVIOContext *pb, AVDictionary **metadata,
             break;
         }
 
-        ret = avio_read(pb, buf, ID3v2_HEADER_SIZE);
+        ret = ffio_ensure_seekback(pb, ID3v2_HEADER_SIZE);
+        if (ret >= 0)
+            ret = avio_read(pb, buf, ID3v2_HEADER_SIZE);
         if (ret != ID3v2_HEADER_SIZE) {
             avio_seek(pb, off, SEEK_SET);
             break;