shithub: sox

Download patch

ref: 1d4f474b68c0aefba56df59da735658b69da0807
parent: eabe39a62d599eae8d222ba3d8572f775decdd16
author: cbagwell <cbagwell>
date: Sun Jan 9 11:28:19 EST 2011

Fix bug were FACT chunk was not accounted for in RIFF length
calculation.  Patch by David Bryant.

--- a/ChangeLog
+++ b/ChangeLog
@@ -17,6 +17,7 @@
   o Fix bug were WavPack header was not updated correctly when closing
     file.  Fixed libsox memory leak when closing WavPack files.
     (David Bryant)
+  o Fix RIFF chunk length error when writing 24-bit files. (David Bryant)
 
 Audio device drivers:
 
--- a/src/wav.c
+++ b/src/wav.c
@@ -1362,7 +1362,7 @@
         wFmtSize += 2+wExtSize; /* plus ExtData */
 
     wRiffLength = 4 + (8+wFmtSize) + (8+dwDataLength);
-    if (wFormatTag != WAVE_FORMAT_PCM) /* PCM omits the "fact" chunk */
+    if (isExtensible || wFormatTag != WAVE_FORMAT_PCM) /* PCM omits the "fact" chunk */
         wRiffLength += (8+dwFactSize);
 
     /* dwAvgBytesPerSec <-- this is BEFORE compression, isn't it? guess not. */