#77 flac doesn't respect RIFF subchunk padding byte

closed-fixed
5
2004-10-01
2003-02-02
No

If a WAV file has extra info chunks (IART, ICMT, etc) the
FLAC encoder (FLAC v1.1.0 Windows - also tested with
1.0.4, same result) spits out error messages, although it
seems to still encode the file ok.

This is the output:
--------------------------------------------
X:\>flac RIFF-info.wav

flac 1.1.0, Copyright (C) 2000,2001,2002,2003 Josh
Coalson
flac comes with ABSOLUTELY NO WARRANTY. This
is free software, and you are
welcome to redistribute it under certain conditions.
Type `flac' for details.

options: -P 4096 -b 4608 -m -l 8 -q 0 -r 3,3
RIFF-info.wav: 68% complete, ratio=0.540RIFF-info.wav:
WARNING: skipping unknown
sub-chunk 'LIST'
RIFF-info.wav: WARNING: skipping unknown sub-
chunk 'DISP'
RIFF-info.wav: WARNING: skipping unknown sub-
chunk 'DISP'
RIFF-info.wav: ERROR: unexpected EOF
--------------------------------------------

This is the 10-second (44-16-1) test file:
http://www.silisoftware.com/RIFF-info.wav

Same file, no extra chunks, compresses fine:
http://www.silisoftware.com/RIFF-noinfo.wav

Discussion

  • Josh Coalson

    Josh Coalson - 2003-02-27

    Logged In: YES
    user_id=78173

    OK, I grabbed these two files and will look into the problem. Thanks.

    Josh

     
  • Josh Coalson

    Josh Coalson - 2003-02-27
    • assigned_to: nobody --> jcoalson
    • status: open --> open-accepted
     
  • Josh Coalson

    Josh Coalson - 2003-02-27
    • status: open-accepted --> closed-invalid
     
  • Josh Coalson

    Josh Coalson - 2003-02-27

    Logged In: YES
    user_id=78173

    OK, the problem is that the last DISP subchunk in RIFF-info.wav has an
    incorrect size, it says it is 21 bytes when it is really 22.

    You can test this yourself, using hexedit. Change the byte at offset
    0xE34D0 from 0x15 to 0x16 and encode it. It should work as expected.

    Josh

     
  • James Heinrich

    James Heinrich - 2003-02-27

    Logged In: YES
    user_id=429434

    That is actually according to spec (annoying though it is).
    RIFF chunks specify a size, but are actually padded to be
    word-aligned (ie size is an even number), so if it says 21
    bytes, there's 21 bytes of data and 1 byte of padding.

     
  • Josh Coalson

    Josh Coalson - 2003-02-27
    • status: closed-invalid --> open-accepted
     
  • Josh Coalson

    Josh Coalson - 2003-02-27

    Logged In: YES
    user_id=78173

    Hmm, I thought that was only AIFF... I'll reopen this one but it
    should not be much trouble to fix as the AIFF code already
    does this.

    Josh

     
  • Josh Coalson

    Josh Coalson - 2003-02-27
    • summary: skipping unknown sub-chunk (LIST|DISP) --> flac doesn't respect RIFF subchunk padding byte
     
  • Josh Coalson

    Josh Coalson - 2004-07-19

    Logged In: YES
    user_id=78173

    OK, after a long while, I checked in the fix to
    CVS, will close after the next release.

    Josh

     
  • Josh Coalson

    Josh Coalson - 2004-07-19
    • status: open-accepted --> open-fixed
     
  • Brian Willoughby

    Logged In: YES
    user_id=450189

    I think that RIFF was originally a copy of the AIFF spec with the
    byte-order flipped and the header format changed. The fact that
    both are padded to 16-bit boundaries in the same way is not too
    surprising.

     
  • Brian Willoughby

    Logged In: YES
    user_id=450189

    I think that RIFF was originally a copy of the AIFF spec with the
    byte-order flipped and the header format changed. The fact that
    both are padded to 16-bit boundaries in the same way is not too
    surprising.

     
  • Josh Coalson

    Josh Coalson - 2004-10-01
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.