OSDN Git Service

qt-faststart: Abort scanning of the input file if a badly sized atom is encountered
authorMartin Storsjö <martin@martin.st>
Thu, 13 May 2010 19:22:56 +0000 (19:22 +0000)
committerMartin Storsjö <martin@martin.st>
Thu, 13 May 2010 19:22:56 +0000 (19:22 +0000)
If the atom size is 0, qt-faststart currently hangs forever while scanning
the file.

Originally committed as revision 23129 to svn://svn.ffmpeg.org/ffmpeg/trunk

tools/qt-faststart.c

index dca5db1..7bcd5b7 100644 (file)
@@ -163,6 +163,12 @@ int main(int argc, char *argv[])
             break;
         }
         atom_offset += atom_size;
+
+        /* The atom header is 8 (or 16 bytes), if the atom size (which
+         * includes these 8 or 16 bytes) is less than that, we won't be
+         * able to continue scanning sensibly after this atom, so break. */
+        if (atom_size < 8)
+            break;
     }
 
     if (atom_type != MOOV_ATOM) {