Menu

#310 Parsing 0-frame aiff file fails with error: Missing SSND chunk in AIFF file

closed-fixed
nobody
None
5
2020-08-04
2018-06-13
No

When running the sox --info command on a valid aiff file with 0-samples, sox FAILS with message "Missing SSND chunk in AIFF file".

Steps to reproduce:

  1. Create a 0-length aiff file. For example, the attached 0samps.aif file saved from Audacity
  2. Run sox --info 0samps.aif

**Expected output: ** format information about the file

Actual output:

$ sox --info 0samps.aif 
sox FAIL formats: can't open input file `test_data/audacity/0samps.aif': Missing SSND chunk in AIFF file

**Analysis: **
The chunk parsing loop in aiff.c uses a non-zero value of the variable ssndsize to indicate whether the SSND chunk was found (line 91). However ssndsize will be set to 0 if the SSND chunk is found, but the audio region's data length is 0 (line 149).

Suggested fix:

Add a new flag at line 63:

off_t seekto = 0;
size_t ssndsize = 0;

+ int ssndfound = 0;  

Update check at line 91:

-  if (ssndsize > 0)
+  if (ssndfound)
        break;

Set flag when SSND chunk is found at line 149:

ssndsize = chunksize;
ssndfound = 1;

Additional information:
~~~
$ sox --version
sox: SoX v14.4.1

$ xxd 0samps.aif
00000000: 464f 524d 0000 002e 4149 4646 434f 4d4d FORM....AIFFCOMM
00000010: 0000 0012 0001 0000 0000 0008 400e ac44 ............@..D
00000020: 0000 0000 0000 5353 4e44 0000 0008 0000 ......SSND......
00000030: 0000 0000 0000
~~~ ......

1 Attachments

Discussion

  • Ross Bencina

    Ross Bencina - 2018-06-13

    Correction, to the addition at line 149 in suggested fix, should be:

    ssndsize = chunksize;
    
    + ssndfound = 1;
    
     
  • Mans Rullgard

    Mans Rullgard - 2020-08-04
    • status: open --> closed-fixed
     
  • Mans Rullgard

    Mans Rullgard - 2020-08-04

    Fixed.

     

Log in to post a comment.

MongoDB Logo MongoDB