discuss-gnustep
[Top][All Lists]
Advanced

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

Re: Re2: Crash when trying to load corrupt file with NSDictionary -initW


From: Richard Frith-Macdonald
Subject: Re: Re2: Crash when trying to load corrupt file with NSDictionary -initWithContentsOfFile:
Date: Thu, 30 Jun 2005 10:31:19 +0100

On 2005-06-30 10:08:27 +0100 Roland Schwingel <roland.schwingel@onevision.de> wrote:

Hi...

Richard Frith-Macdonald <richard@brainstorm.co.uk> wrote on 30.06.2005 10:34:27:
<roland.schwingel@onevision.de> wrote:>
Unfortunately it does not work and the reason is clear. With my corrupt file
info->didUnique is set to 0 in initDeserializerInfo(), so the GSIArray is
also not initialized and calling GSIArrayCount(&info->array) accesses
uninitialized data. Access to the GSIArray should only be done after
checking the didUnique flag.

Thanks ... I missed that the array could be uninitialised.  Should be fixed
now to check both that the array is initialised and that the index into it
is valid (and raise a different exception message in each case).

With one last small tweak it works now. I added a
break;
after the last else branch you added to terminate the ST_XREF case,
elsewise it would rush directly into the ST_CSTRING case which is
bad.

Wierd ... that didn't happen to me.
In the code I comitted, it should be impossible to fall through to the ST_CSTRING case, as we have three possible paths through the ST_XREF case:

1. the array is uninitialised and we raise an exception.
2. the array index is invalid and we raise an exception.
3. we return the cross referenced object from the array.

I deleted my local copy and checked it out from CVS, and the checked out code looks fine ... so perhaps your version is messed up somehow. Could you try deleting your local copy and checking out a fresh copy of the file?






reply via email to

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