Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 185332 - games-arcade/netris Netris protocol uses platform-dependent int types.
Summary: games-arcade/netris Netris protocol uses platform-dependent int types.
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Games (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: Gentoo Games
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-14 17:14 UTC by Jakub Zawadzki
Modified: 2009-01-29 03:34 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Zawadzki 2007-07-14 17:14:36 UTC
In netris.h there's definition of netint2 and netint4 with comment:

/*
 * The following definitions are to ensure network compatibility even if
 * the sizes of ints and shorts are different.  I'm not sure exactly how
 * to deal with this problem, so I've added an abstraction layer.
 */
typedef short netint2;
typedef long netint4;

However long (netint4) has 8 bytes on x86-64, and 4 bytes on x86
netint4 is used to send program version, version of protocol.
and also (which is more critical) to send seed and interval

BTW. author is writing about it on ftp://ftp.netris.org/pub/netris/netris-README
,Netris should build cleanly on 64-bit systems such as the Alpha,
although you might need to edit the definitions for netint{2,4},
hton{2,4}, and ntoh{2,4} in netris.h.'

So if you play game on your own amd64 machine with somebody who has got x86
you'll got other pieces than your opponent, and if both of you set same -i option you'll get:
"Your opponent's version of Netris predates the -i option.
For fairness, you shouldn't use the -i option either."

because on x86-64 seed OFFSET is +8 and inteval OFFSET is +16
and on x86 seed OFFSET is +4 and interval OFFSET is +8

I think we should use int32_t for netint4, and int16_t for netint2 declared in <sys/types.h> [which should be portable on all systems]

or use int for netint4, and short for netint2 [which is the same size for x86 and x86-64, don't know what about 16bit systems]
Comment 1 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2008-12-08 02:36:19 UTC
The games team can add amd64@g.o back to CC to provide additional testing if so desired. Until then, nothing for amd64 to do. Thanks.
Comment 2 Mr. Bones. (RETIRED) gentoo-dev 2009-01-29 03:34:52 UTC
should be fixed