summaryrefslogtreecommitdiff
path: root/libavformat/id3v2.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-10-02 07:16:09 +0200
committerAnton Khirnov <anton@khirnov.net>2011-10-03 13:06:41 +0200
commit1e18d32d01fc0ac784a0d592b46215bfbdcc579d (patch)
treed212479c1a5f226a251ee9cf27da5e4105b56ba1 /libavformat/id3v2.c
parent24ec9ac4755525e9875fb121aba4d360df916447 (diff)
id3v2: don't discard the whole tag when encountering empty frames.
While they're technically invalid, it's better to skip them and try to read the rest of the tag.
Diffstat (limited to 'libavformat/id3v2.c')
-rw-r--r--libavformat/id3v2.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 68c1709b93..a3d7ae6c5f 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -401,13 +401,19 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t
tag[3] = 0;
tlen = avio_rb24(s->pb);
}
- if (tlen <= 0 || tlen > len - taghdrlen) {
+ if (tlen < 0 || tlen > len - taghdrlen) {
av_log(s, AV_LOG_WARNING, "Invalid size in frame %s, skipping the rest of tag.\n", tag);
break;
}
len -= taghdrlen + tlen;
next = avio_tell(s->pb) + tlen;
+ if (!tlen) {
+ if (tag[0])
+ av_log(s, AV_LOG_DEBUG, "Invalid empty frame %s, skipping.\n", tag);
+ continue;
+ }
+
if (tflags & ID3v2_FLAG_DATALEN) {
avio_rb32(s->pb);
tlen -= 4;