Message175450
| Author |
ckern |
| Recipients |
ckern |
| Date |
2012年11月12日.15:04:11 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1352732651.92.0.893248719316.issue16461@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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 wave.py:
476c476
< self._file.write(struct.pack('<l', self._datalength))
---
> self._file.write(struct.pack('<L', self._datalength))
485c485
< self._file.write(struct.pack('<l', 36 + self._datawritten))
---
> self._file.write(struct.pack('<L', 36 + self._datawritten))
487c487
< 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: mkdummywav.py $duration_in_minutes
Maybe the problem also occurs at python 3, I don't know. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年11月12日 15:04:11 | ckern | set | recipients:
+ ckern |
| 2012年11月12日 15:04:11 | ckern | set | messageid: <1352732651.92.0.893248719316.issue16461@psf.upfronthosting.co.za> |
| 2012年11月12日 15:04:11 | ckern | link | issue16461 messages |
| 2012年11月12日 15:04:11 | ckern | create |
|