bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSArchiver bug on 64bit systems


From: Wim Oudshoorn
Subject: NSArchiver bug on 64bit systems
Date: Fri, 25 Aug 2006 17:26:52 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/22.0.50 (darwin)

NSArchiver writes a flattened object graph.
In order to do so, it keeps track of all the objects it has
already written.  This is done in the 

GSIMapTable _repMap 

ivar.  As can be seen this is a GSIMap.  Unfortunately 
NSArchiver.m starts with 


#define GSI_MAP_HASH(M, X)            ((X).uint)
#define GSI_MAP_EQUAL(M, X, Y)        ((X).uint == (Y).uint)


this is a problem because on the AMD64 bit architecture we use
a uint is 32 bits and pointers are 64 bits.

So if we encode two objects whose lower 32 bits of the address are the 
same we will encode the second object wrong (as a reference to the first.)

I don't know why uint was chosen instead of ptr.  But this would by 
my obvious suggestion to fix this bug.

Oh before someone starts telling me that it is highly unlikely,
we have observed this in practice.   And let me tell you,
debugging an NSArchive containing about half a million objects is
no fun.

Wim Oudshoorn




reply via email to

[Prev in Thread] Current Thread [Next in Thread]