[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdeextragear-2/taglib/mpeg
From:       Scott Wheeler <wheeler () kde ! org>
Date:       2003-11-23 7:33:40
[Download RAW message or body]

CVS commit by wheeler: 

More valgrinding -- don't index into the buffer if it's smaller than the
minimum possible size for an mpeg header.


  M +6 -0      mpegfile.cpp   1.36
  M +0 -2      mpegheader.cpp   1.8


--- kdeextragear-2/taglib/mpeg/mpegfile.cpp  #1.35:1.36
@@ -370,4 +370,10 @@ long MPEG::File::lastFrameOffset()
     ByteVector buffer = readBlock(bufferSize());
 
+    // If the amount of data is smaller than an MPEG header (4 bytes) there's no
+    // chance of this being valid.
+
+    if(buffer.size() < 4)
+      return -1;
+
     for(int i = buffer.size() - 1; i >= 0; i--) {
       if(uchar(buffer[i]) == 0xff && secondSynchByte(buffer[i + 1]))

--- kdeextragear-2/taglib/mpeg/mpegheader.cpp  #1.7:1.8
@@ -238,6 +238,4 @@ void MPEG::Header::parse(const ByteVecto
   d->isOriginal = flags[1];
 
-  // TODO: Add emphasis for completeness
-
   // Calculate the frame length
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic