#43 Decoding non 8/16/24 bps to raw format should fail cleanly

1.3.0
closed-fixed
nobody
None
5
2015-10-03
2010-07-16
No

When decoding a FLAC file with bits per sample that is not a multiple of 8 and outputting in raw format, the decoder gets as far as the write callback before realising that it doesn't know how to write the data. It then fails with an unhelpful message (or trips an assert() in debug mode). The attached patch performs the check earlier, and gives a more helpful error message.

#v+
# metaflac --show-bps data_20bps.flac
20
#v-

without patch:

#v+
# flac -dc --force-raw-format --sign signed --endian little data_20bps.flac

flac 1.2.1, Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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.

data_20bps.flac: ERROR while decoding data
state = FLAC__STREAM_DECODER_READ_FRAME
#v-

with patch:

#v+
# flac -dc --force-raw-format --sign signed --endian little data_20bps.flac

flac 1.2.1, Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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.

data_20bps.flac: ERROR: bits per sample is 20, must be 8/16/24 for raw format output
#v-

Discussion

  • Erik

    Erik - 2015-10-03
    • status: open --> closed-fixed
    • Group: --> 1.3.0
     
  • Erik

    Erik - 2015-10-03

    Provided patch no longer applies, but fixed in:

    commit c671e1c91ad3a9a7b40500122e278cc03e6e1daa
    Author: Erik de Castro Lopo <erikd@mega-nerd.com>
    Date:   Sun Oct 4 10:52:23 2015 +1100
    
    flac: Error out if decoding RAW with bits != (8|16|24)
    
    Suggested by Christopher Key.
    
    Closes: https://sourceforge.net/p/flac/patches/43/
    

    Thanks.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks