Public bug reported:
Libaudiofile in this version produces wrong length information in the
data and RIFF chunk because it internally uses the data type "float" for
length calculations.
To reproduce the bug, try to create a wav file with 77.777.777 frames, 8
bit/sample, stereo. The entries in the data and RIFF chunk will be one
frame too short (in this example).
This is caused by a wrong calculation in libaudiofile/wavewrite.c,
function _af_wave_update, line 248:
dataLength = (u_int32_t) track->totalfframes *
_af_format_frame_size(&track->f, AF_FALSE);
The root cause is that _af_format_frame_size(...) returns a 'float',
thus the track->totalfframes is first casted to float, then the
resulting float is multiplied with the float of _af_format_frame_size.
At this point the result is already wrong due to loss of accuracy.
A simple fix for that is to change the _af_format_frame_size() return
value from float to double.
Please take into mind that other file formats and functions might also
be affected!!!
I attached a patch that solves the problem for me, I also changed the
function _af_format_sample_size to be sure. Maybe even more places need
to be patched (didn't check that).
ProblemType: Bug
Architecture: i386
Date: Sun Feb 8 19:54:09 2009
Dependencies:
libgcc1 1:4.2.4-1ubuntu3
gcc-4.2-base 4.2.4-1ubuntu3
libc6 2.7-10ubuntu4
DistroRelease: Ubuntu 8.04
Package: libaudiofile0 0.2.6-7ubuntu1
PackageArchitecture: i386
ProcEnviron:
PATH=/home/username/bin:/home/username/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
LANG=de_DE.UTF-8
SHELL=/bin/bash
SourcePackage: audiofile
Uname: Linux 2.6.24-22-generic i686
** Affects: audiofile (Ubuntu)
Importance: Undecided
Status: New
** Tags: apport-bug
--
libaudiofile-0.2.6-6 produces wrong wav headers
https://bugs.launchpad.net/bugs/327018
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs