[flac-dev] 2GB limit patch

Timothy B. Terriberry tterribe at xiph.org
Mon Mar 4 14:39:34 PST 2013


Erik de Castro Lopo wrote:
> Err, thats a link to a post talking about flac's WAV reader being limited
> to 4Gig files. Problem is, *all* WAV files greater than 4Gig are mal-formed.
> Due to limitations in the way WAV files are specified, no valid WAV file
> can ever be over 4Gig.

And most don't work over 2 GB. The solution we (Xiph) have used in other 
projects (opusenc, oggenc) is to treat sizes over ~2 GB as meaning "Just 
keep reading until EOF." See wav_open() audio-in.c in opus-tools. It 
turns out you need to use slightly less than 2 GB for the limit to 
handle the output of some tools. We also provide an --ignorelength 
option to request this behavior regardless of the length in the header 
(which lets it work with tools that just truncate the size to 32 bits).


More information about the flac-dev mailing list