[FFmpeg-cvslog] id3v2: fix skipping extended header in id3v2.4

Anton Khirnov git at videolan.org
Mon Apr 2 02:28:49 CEST 2012


ffmpeg | branch: release/0.6 | Anton Khirnov <anton at khirnov.net> | Sat Mar 31 07:52:42 2012 +0200| [f70c720d42d0e222b70fc580a36832a7b0ef89fa] | committer: Anton Khirnov

id3v2: fix skipping extended header in id3v2.4

In v2.4, the length includes the length field itself.
(cherry picked from commit ddb4431208745ea270dce8fce4cba999f0ed4303)

Conflicts:

	libavformat/id3v2.c

Signed-off-by: Anton Khirnov <anton at khirnov.net>

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

 libavformat/id3v2.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 6fa11db..8c1c071 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -187,8 +187,17 @@ void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags)
         goto error;
     }
 
-    if (isv34 && flags & 0x40) /* Extended header present, just skip over it */
-        url_fskip(s->pb, get_size(s->pb, 4));
+    if (isv34 && flags & 0x40) { /* Extended header present, just skip over it */
+        int extlen = get_size(s->pb, 4);
+        if (version == 4)
+            extlen -= 4;     // in v2.4 the length includes the length field we just read
+
+        if (extlen < 0) {
+            reason = "invalid extended header length";
+            goto error;
+        }
+        url_fskip(s->pb, extlen);
+    }
 
     while (len >= taghdrlen) {
         if (isv34) {



More information about the ffmpeg-cvslog mailing list