Feeding NSUnarchiver bad data can cause crash
Feeding NSUnarchiver bad data can cause crash
- Subject: Feeding NSUnarchiver bad data can cause crash
- From: Jeremy Dronfield <email@hidden>
- Date: Wed, 2 Jun 2004 17:44:14 +0100
If you provide NSUnarchiver with data which is not unarchivable, an
error results. Using the class method +unarchiveObjectWithData: with
bad data produces a warning:
*** +[NSUnarchiver unarchiveObjectWith
Data:]: extra data discarded
Sometimes - maybe about 1 in 100 - this causes a crash. Using the
designated initializer, -initForReadingWithData: followed by
-decodeObject does not produce a warning, but does produce a crash with
about the same frequency, described as
*** malloc_zone_malloc[414]: argument too large: 4294967286
Obviously, the solution is not to feed NSUnarchiver bad data. But given
that bad data happens, and a crash can result, why isn't there a method
like -[NSData canBeUnarchived] for use in situations where bad data
might be a risk? Does anyone know of a workaround which could provide a
comparable check?
Regards,
-Jeremy
===================================
SkoobySoft, home of viJournal
email: email@hidden or visit:
http://freespace.virgin.net/jeremy.dronfield/skoobysoft.html
===================================
_______________________________________________
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.