• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Feeding NSUnarchiver bad data can cause crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Re: Feeding NSUnarchiver bad data can cause crash (From: "Douglas A. Welton" <email@hidden>)

  • Prev by Date: Re: Ugly bug in Foundation, beware!
  • Next by Date: function pointer in Cocoa
  • Previous by thread: Re: Feeding NSUnarchiver bad data can cause crash
  • Next by thread: Re: Feeding NSUnarchiver bad data can cause crash
  • Index(es):
    • Date
    • Thread