Bug#434741: hex-a-hop: segfaults right after trying to start

Bas Wijnen wijnen at debian.org
Thu Jul 26 16:46:13 UTC 2007


On Thu, Jul 26, 2007 at 02:03:23PM +0200, Gerfried Fuchs wrote:
>  I guess the trying to allocate huge parts of memory might be related to
> an endianness problem within the .dat file.  Is the dat file format
> documented somehwere?  Maybe someone able to do so wants to check that
> code for endianness problems in that area?

You are right, indeed.  The offending code is in packfile.h (PackFile1::Read):

	int size;
	fseek(f, -(int)sizeof(size), SEEK_END);
	int end_offset = ftell(f); fread(&size, sizeof(size), 1, f);
	fseek(f, end_offset - size, SEEK_SET);

Obviously, size needs to be transformed to host endianness after reading
it.  Also, it seems broken because it uses sizeof(size).  This means
that on 64bit architectures, it will read the last 8 bytes of the file.
Since the file itself is in arch-all, and thus not rebuilt, this cannot
be correct.

Sorry I'm not attaching a patch, but with this info it shouldn't be too
hard for someone else to write one.

Hope that helps,
Bas

-- 
I encourage people to send encrypted e-mail (see http://www.gnupg.org).
If you have problems reading my e-mail, use a better reader.
Please send the central message of e-mails as plain text
   in the message body, not as HTML and definitely not as MS Word.
Please do not use the MS Word format for attachments either.
For more information, see http://pcbcn10.phys.rug.nl/e-mail.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-games-devel/attachments/20070726/ffdaace1/attachment.pgp 


More information about the Pkg-games-devel mailing list