This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ckern
Recipients ckern
Date 2012-11-12.15:04:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Writing .wav files is limited to a file size of 2 Gib, while
the WAV file format itself supports up to 4 Gib.
Trying to write a file beyond 2 Gib (e.g. 203 minutes at
CD quality (i.e. 44.1 kHz, 2 channels, 16 bit)) will crash
at the moment when self._datawritten exceeds 2^31-1 bytes.
This is due to the fact that, in method "_patchheader",
the variable "self._datawritten" is written with
"struct.pack('<l')" (signed long integer)
instead of
"struct.pack('<L')" (unsigned long integer---which would
conform to the WAV file format spefication).

patch to
<         self._file.write(struct.pack('<l', self._datalength))
>         self._file.write(struct.pack('<L', self._datalength))
<         self._file.write(struct.pack('<l', 36 + self._datawritten))
>         self._file.write(struct.pack('<L', 36 + self._datawritten))
<         self._file.write(struct.pack('<l', self._datawritten))
>         self._file.write(struct.pack('<L', self._datawritten))

This patch also patches the "_write_header" method, which
has the same problem (but will lead to a crash only
in very rare cases).

By the way: "_patchheader" should be renamed to "_patch_header"
in order to be in harmony with the other function/method names
of this module.

Attached you'll find a very simple python 2 script which will
reproduce the problem. Usage: $duration_in_minutes

Maybe the problem also occurs at python 3, I don't know.
Date User Action Args
2012-11-12 15:04:11ckernsetrecipients: + ckern
2012-11-12 15:04:11ckernsetmessageid: <>
2012-11-12 15:04:11ckernlinkissue16461 messages
2012-11-12 15:04:11ckerncreate