Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Feeding NSUnarchiver bad data can cause crash



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 unarchiveObjectWithData:]: 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.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.