Menu

#286 Skipped AIFF chunks fail to account for pad byte.

closed-fixed
aiff (1)
4
2018-10-18
2017-01-05
No

In aiff.c, in the code that skips chunks that sox ignores, the read past the chunk's data (line 319) fails to account for the pad byte if the chunksize is odd.

As such, if you have an AIFF file with a chunk sox ignores (like, say, 'ID3 ') that has an odd number of bytes, sox gets out of sync with the chunks in the file, and fails to find it.

Here's such a file: https://drive.google.com/file/d/0B1eCSfs15HPRemFxQ2NtRTdrQ3M/view?usp=sharing
Quicktime, iTunes, and several DAWs will all read this file. sox will not:

$ soxi -V4 11\ -\ See.aif 
soxi INFO formats: detected file format type `aiff'
soxi DBUG aiff: AIFFstartread: ignoring `ID3 ' chunk
soxi DBUG aiff: AIFFstartread: ignoring `' chunk
soxi FAIL formats: can't open input file `11 - See.aif': AIFF: no sound data on input file

Notice that has been confused by a chunk with no name after the ignored 'ID3 ' chunk. A quick hexdump reveals that the ID3 chunk has an odd length, and that empty name chunk is really sox reading the pad null byte as the next chunk name:

$ hexdump -C 11\ -\ See.aif | head -15
00000000  46 4f 52 4d 03 3f 7c aa  41 49 46 46 43 4f 4d 4d  |FORM.?|.AIFFCOMM|
00000010  00 00 00 12 00 02 00 cf  de fb 00 10 40 0e ac 44  |............@..D|
00000020  00 00 00 00 00 00 49 44  33 20 00 00 00 87 49 44  |......ID3 ....ID|
00000030  33 04 00 00 00 00 00 7d  54 41 4c 42 00 00 00 11  |3......}TALB....|
00000040  00 00 03 50 54 48 20 32  30 31 36 20 49 6d 70 72  |...PTH 2016 Impr|
00000050  6f 76 00 54 50 45 31 00  00 00 14 00 00 03 50 75  |ov.TPE1.......Pu|
00000060  6e 6a 61 62 69 20 54 65  61 20 48 6f 75 73 65 00  |njabi Tea House.|
00000070  00 54 43 4f 4d 00 00 00  13 00 00 03 50 75 6e 6a  |.TCOM.......Punj|
00000080  61 62 69 20 54 65 61 20  48 6f 75 73 65 00 41 50  |abi Tea House.AP|
00000090  49 43 00 00 00 00 00 00  54 49 54 32 00 00 00 05  |IC......TIT2....|
000000a0  00 00 03 53 65 65 00 54  52 43 4b 00 00 00 04 00  |...See.TRCK.....|
000000b0  00 03 31 31 00 00 53 53  4e 44 03 3f 7b f4 00 00  |..11..SSND.?{...|
000000c0  00 00 00 00 00 00 00 01  ff ff 00 03 00 04 00 05  |................|
000000d0  00 0c ff ff 00 0e ff fd  00 11 ff fb 00 0d 00 07  |................|
000000e0  00 0f 00 10 00 15 00 12  00 17 00 0c 00 0f ff fe  |................|

Discussion

  • Mans Rullgard

    Mans Rullgard - 2018-04-26
    • labels: --> aiff
    • status: open --> pending-fixed
    • assigned_to: robs --> Mans Rullgard
     
  • Mans Rullgard

    Mans Rullgard - 2018-04-29
    • status: pending-fixed --> closed-fixed
     
  • Daniel

    Daniel - 2018-09-12

    I ran into the same bug. Is there any information on when a new (bugfix-)version will be released?
    Those bugs seem to get fixed, but most distors/package manegers don't install from trunk and so these bugfixes don't reach anyone.

     
  • tubegeek

    tubegeek - 2018-10-18

    As per the question above: I'm showing version "sox 14.4.2_1 already installed" per my brew upgrade command. Same bug I think? - my workaround was to remove all markers and process the file.

     

Log in to post a comment.

MongoDB Logo MongoDB