]> granicus.if.org Git - taglib/commitdiff
Fix reading corrupted ID3v2 syncdata
authorTsuda kageyu <tsuda.kageyu@gmail.com>
Sat, 20 Apr 2013 00:28:19 +0000 (09:28 +0900)
committerTsuda kageyu <tsuda.kageyu@gmail.com>
Sat, 20 Apr 2013 00:40:01 +0000 (09:40 +0900)
taglib/mpeg/id3v2/id3v2synchdata.cpp

index 60698d3cb0962476a9017709a9001c89f645fc32..4acfd914797e92fc63f6a697999829849dc3e4ea 100644 (file)
@@ -49,7 +49,14 @@ TagLib::uint SynchData::toUInt(const ByteVector &data)
     // Invalid data; assume this was created by some buggy software that just
     // put normal integers here rather than syncsafe ones, and try it that
     // way.
-    sum = data.toUInt();
+    if(data.size() >= 4) {
+      sum = data.toUInt(0, true);
+    }
+    else {
+      ByteVector tmp(data);
+      tmp.resize(4);
+      sum = tmp.toUInt(0, true);
+    }
   }
 
   return sum;