]> granicus.if.org Git - taglib/commitdiff
Fix an excessive loop when parsing an APE file.
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Tue, 23 Dec 2014 11:58:36 +0000 (20:58 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Tue, 23 Dec 2014 11:58:36 +0000 (20:58 +0900)
taglib/ape/apetag.cpp

index e1252193737ee092f7a1a5385d4995082d8c72f3..22471d40b90e6fa4491c19c4259b37954673e9a6 100644 (file)
@@ -368,10 +368,13 @@ ByteVector APE::Tag::render() const
 
 void APE::Tag::parse(const ByteVector &data)
 {
-  uint pos = 0;
-
   // 11 bytes is the minimum size for an APE item
 
+  if(data.size() < 11)
+    return;
+
+  uint pos = 0;
+
   for(uint i = 0; i < d->footer.itemCount() && pos <= data.size() - 11; i++) {
     APE::Item item;
     item.parse(data.mid(pos));