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


_______________________________________________
Bug-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to