Re: Feeding NSUnarchiver bad data can cause crash
Re: Feeding NSUnarchiver bad data can cause crash
- Subject: Re: Feeding NSUnarchiver bad data can cause crash
- From: Ondra Cada <email@hidden>
- Date: Thu, 3 Jun 2004 17:34:54 +0200
Douglas,
On 3.6.2004, at 17:10, Douglas A. Welton wrote:
>
implementing your own. Something like this should work...
Not using the return statements this way:
>
- (BOOL)canBeUnarchived: (NSData *)Target_Data
>
{
>
id Archive;
>
NS_DURING
>
Archive = [NSUarchiver unarchiveObjectWithData: Target_Data]
>
return YES;
>
NS_HANDLER
>
return NO;
>
NS_ENDHANDLER
>
}
>
>
... note the standard disclaimers apply.
Especially, don't ever use return inside of NS_... blocks. Either go
@try, or use NS_VALUERETURN (or whatever it is called, I can't recall
the very now), or--the best way IMHO--store the result into a variable:
BOOL okay=NO;
NS_DURING
...
okay=YES;
NS_HANDLER ... NS_ENDHANDLER
return okay;
---
Ondra Hada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.