[Flac-dev] amd64 issue with flac-1.1.3 beta2

David Collett daveco at users.sourceforge.net
Sat Nov 4 16:17:03 PST 2006


Hi Josh,

I got a new computer yesterday, a 64bit intel core 2 duo. I am running
the amd64 port of Ubuntu 6.10 (edgy). I compiled flac-1.1.3 beta and had
trouble encoding:

dave at jimmy:/tmp$ ./bin/flac -o /tmp/foo.flac foo.wav 

-----------------
flac 1.1.3-beta2, Copyright (C) 2000,2001,2002,2003,2004,2005,2006  Josh Coalson
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

options: -P 8192 -b 4608 -m -l 8 -q 0 -r 3,3
foo.wav: 99% complete, ratio=0.722
foo.wav: ERROR during encoding
         state = FLAC__STREAM_ENCODER_CLIENT_ERROR

An error occurred while writing; the most common cause is that the disk is full.
-----------------

Strace reveals this:

write(4, "\377\370Y\210\340\266\253\223\22\0\2\f?\377\375\235\235"..., 1652) = 1652
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 4096
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 4096
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 4096
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 4096
write(4, "\377\370Y\30\340\266\254\320\22\0\1\f\31\323\356R\315/"..., 1276) = 1276
write(4, "", 47747151429632)            = 199596
write(4, "", 47747151230036)            = -1 EFAULT (Bad address)
write(2, "\nfoo.wav: ERROR during encoding\n", 32
foo.wav: ERROR during encoding

The final write is getting a bogus size.

I think I have tracked it down to "FLAC__bitbuffer_get_buffer" in
bitbuffer.c taking an unsigned * for bytes, but "write_bitbuffer_" in
stream_encoder.c is passing a size_t *. On my system it looks like unsigned
is 4 bytes, where size_t is 8 bytes.

Changing FLAC__bitbuffer_get_buffer to take a size_t * seems to fix it.
But as I said, I only have 1 days amd64 experience, so I don't really
know what I am doing! I also havent checked if anyone else is calling
get_buffer with an unsigned * so maby this will break elseware now.

Has anyone else tested on amd64?
Let me know if you want me to do any more tests.

Thanks,
Dave


More information about the Flac-dev mailing list