ExifTool (8.66) hangs on corrupt .avi file

Started by AllBackJack, October 08, 2011, 02:26:39 PM

Previous topic - Next topic

AllBackJack

This is not a major problem with ExifTool, since my file was corrupted. But it's still annoying to have it hang.

I have a lot of large ( >20GB) avi files. Recently I noticed that a couple of files on a secondary drive were different from the files on my primary drive. Not by size, but by date and by doing a simple binary comparison. I thought that it might just be a minor header difference, and so I ran ExifTool on both copies of the files that were different. On one copy ExifTool ran fine. On the other it just hung, with no .txt output. So I set -v to various levels, and it seems that ExifTool is getting a corrupt count of 0 in the file, so it keeps on reading the same item over and over. It might pay to put into the code a simple test to check for this infinite looping condition

Output of good file (with non-interesting output lines removed down to the RIFF):

  ExifToolVersion = 8.66
  FileName = Mark and Diane's Wedding - 1997 - Part 1.avi
  Directory = K:/Digitized Old Video and Movie Files
  FileSize = 28783330188
  FileModifyDate = 1266969636
  FilePermissions = 33206
  FileType = AVI
  MIMEType = video/x-msvideo
RIFF 'LIST_hdrl' chunk (64632 bytes of data):
  Hdrl (SubDirectory) -->
  - Tag 'LIST_hdrl' (64632 bytes)
  + [Hdrl directory, 64632 bytes]
....................  I cut out the duplicate header from here.....................
  | + [OpenDML directory, 256 bytes]
  | | ExtendedAVIHeader (SubDirectory) -->
  | | - Tag 'dmlh' (248 bytes)
  | | + [BinaryData directory, 248 bytes]
  | | | TotalFrameCount = 227672
  | | | - Tag 0x0000 (4 bytes, int32u[1])
RIFF 'LIST_movi' chunk (1069461796 bytes of data):
RIFF 'idx1' chunk (140032 bytes of data):
RIFF 'RIFF' chunk (1069583548 bytes of data):
RIFF 'LIST_movi' chunk (1069583532 bytes of data):
RIFF 'RIFF' chunk (1069583544 bytes of data):
RIFF 'LIST_movi' chunk (1069583528 bytes of data):
RIFF 'RIFF' chunk (1069637768 bytes of data):
RIFF 'LIST_movi' chunk (1069637752 bytes of data):
RIFF 'RIFF' chunk (1069615576 bytes of data):
RIFF 'LIST_movi' chunk (1069615560 bytes of data):
RIFF 'RIFF' chunk (1069583548 bytes of data):
RIFF 'LIST_movi' chunk (1069583532 bytes of data):
RIFF 'RIFF' chunk (1069583544 bytes of data):
RIFF 'LIST_movi' chunk (1069583528 bytes of data):
RIFF 'RIFF' chunk (1069637768 bytes of data):
RIFF 'LIST_movi' chunk (1069637752 bytes of data):
RIFF 'RIFF' chunk (1069647608 bytes of data):
RIFF 'LIST_movi' chunk (1069647592 bytes of data):
RIFF 'RIFF' chunk (1069583548 bytes of data):
RIFF 'LIST_movi' chunk (1069583532 bytes of data):
RIFF 'RIFF' chunk (1069583544 bytes of data):
RIFF 'LIST_movi' chunk (1069583528 bytes of data):
RIFF 'RIFF' chunk (1069637768 bytes of data):
RIFF 'LIST_movi' chunk (1069637752 bytes of data):
RIFF 'RIFF' chunk (1069615576 bytes of data):
RIFF 'LIST_movi' chunk (1069615560 bytes of data):
RIFF 'RIFF' chunk (1069583548 bytes of data):
RIFF 'LIST_movi' chunk (1069583532 bytes of data):
RIFF 'RIFF' chunk (1069583544 bytes of data):
RIFF 'LIST_movi' chunk (1069583528 bytes of data):
RIFF 'RIFF' chunk (1069637768 bytes of data):
RIFF 'LIST_movi' chunk (1069637752 bytes of data):
RIFF 'RIFF' chunk (1069615576 bytes of data):
RIFF 'LIST_movi' chunk (1069615560 bytes of data):
RIFF 'RIFF' chunk (1069615580 bytes of data):
RIFF 'LIST_movi' chunk (1069615564 bytes of data):
RIFF 'RIFF' chunk (1069583544 bytes of data):
RIFF 'LIST_movi' chunk (1069583528 bytes of data):
RIFF 'RIFF' chunk (1069637768 bytes of data):
RIFF 'LIST_movi' chunk (1069637752 bytes of data):
RIFF 'RIFF' chunk (1069615576 bytes of data):
RIFF 'LIST_movi' chunk (1069615560 bytes of data):
RIFF 'RIFF' chunk (1069583544 bytes of data):
RIFF 'LIST_movi' chunk (1069583528 bytes of data):
RIFF 'RIFF' chunk (1069583548 bytes of data):
RIFF 'LIST_movi' chunk (1069583532 bytes of data):
RIFF 'RIFF' chunk (1069637768 bytes of data):
RIFF 'LIST_movi' chunk (1069637752 bytes of data):
RIFF 'RIFF' chunk (1069615576 bytes of data):
RIFF 'LIST_movi' chunk (1069615560 bytes of data):
RIFF 'RIFF' chunk (1069583544 bytes of data):
RIFF 'LIST_movi' chunk (1069583528 bytes of data):
RIFF 'RIFF' chunk (973493252 bytes of data):
RIFF 'LIST_movi' chunk (973493236 bytes of data):


And here's the bad file:

  ExifToolVersion = 8.66
  FileName = Mark and Diane's Wedding - 1997 - Part 1.avi
  Directory = B:/Digitized Old Video and Movie Files
  FileSize = 28783330188
  FileModifyDate = 1296332932
  FilePermissions = 33206
  FileType = AVI
  MIMEType = video/x-msvideo
RIFF 'LIST_hdrl' chunk (64632 bytes of data):
  Hdrl (SubDirectory) -->
  - Tag 'LIST_hdrl' (64632 bytes)
  + [Hdrl directory, 64632 bytes]
....................  I cut out the duplicate header from here.....................
  | OpenDML (SubDirectory) -->
  | - Tag 'LIST_odml' (256 bytes)
  | + [OpenDML directory, 256 bytes]
  | | ExtendedAVIHeader (SubDirectory) -->
  | | - Tag 'dmlh' (248 bytes)
  | | + [BinaryData directory, 248 bytes]
  | | | TotalFrameCount = 227672
  | | | - Tag 0x0000 (4 bytes, int32u[1])
RIFF 'LIST_movi' chunk (1069461796 bytes of data):
RIFF 'idx1' chunk (140032 bytes of data):
RIFF 'RIFF' chunk (1069583548 bytes of data):
RIFF 'LIST_movi' chunk (1069583532 bytes of data):
RIFF 'RIFF' chunk (1069583544 bytes of data):
RIFF 'LIST_movi' chunk (1069583528 bytes of data):
RIFF 'NULNULNULNUL' chunk (0 bytes of data):                 (Note:  I put in the NUL because it is the null character)
RIFF_NULNULNULNUL =
- Tag '\x00\x00\x00\x00' (0 bytes)
RIFF 'NULNULNULNUL' chunk (0 bytes of data):
RIFF_NULNULNULNUL =
- Tag '\x00\x00\x00\x00' (0 bytes)
RIFF 'NULNULNULNUL' chunk (0 bytes of data):
RIFF_NULNULNULNUL =
- Tag '\x00\x00\x00\x00' (0 bytes)
RIFF 'NULNULNULNUL' chunk (0 bytes of data):
RIFF_NULNULNULNUL =
- Tag '\x00\x00\x00\x00' (0 bytes)

....... goes on forever.



Phil Harvey

A real hang is serious.  ExifTool should not hang, even on a corrupt file.  I don't think this is a true hang though, but it is still something I should fix.  I think if you waited long enough, it would parse through the entire file then finally end (parsing 8 bytes at a time may be very, very slow though -- at this rate an 8 MB file would produce 4 million lines of verbose output).

I should maybe just abort if I see a "\0\0\0\0" chunk of zero length.  I'll look into this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).