Re: Replace -[NSKeyedUnarchiver unarchiveObjectWithData:] so it doesn't crash on corrupt archive
Re: Replace -[NSKeyedUnarchiver unarchiveObjectWithData:] so it doesn't crash on corrupt archive
- Subject: Re: Replace -[NSKeyedUnarchiver unarchiveObjectWithData:] so it doesn't crash on corrupt archive
- From: Jerry Krinock <email@hidden>
- Date: Thu, 2 Jul 2009 22:42:40 -0700
On 2009 Jul 02, at 21:11, Michael Ash wrote:
Is there a reason you can't just implement a new method in a category
and not replace the existing one? It will be just as safe in your
code, just as easy to use,
I'd considered doing that and yes it could be done. But then it would
have a different method name that I'd have to remember to use instead
of -unarchiveObjectWithData:.
Replacing a Cocoa method seems like it should only be done if the
original method shipped by Apple is buggy. I believe that's the case
here. The only behavior I'm losing is a potential crash.
I suppose Method Replacement has disadvantages too. I have to
remember to include this method replacement file in any new project I
start, or else I'll get the old crashy behavior, since I'll be out of
the habit of using try/catch.
and it won't run the potential risk of screwing up code that you
don't control.
Interesting -- but the only "screwing up" I'm doing is allowing it to
execute beyond a point where it otherwise would have crashed. I
suppose that if someone is using this crashing "feature" of -
unarchiveObjectWithData: as some kind of self-destruct security
mechanism, I could be introducing a security hole :))
Anyhow, I get your point.
Thanks, Michael.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden