• 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
Feeding NSUnarchiver bad data can cause crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 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.


  • Follow-Ups:
    • Re: Feeding NSUnarchiver bad data can cause crash
      • From: "Douglas A. Welton" <email@hidden>
  • Prev by Date: Re: Password!!!!
  • Next by Date: Re: Grumpy pills
  • Previous by thread: Re: Password!!!!
  • Next by thread: Re: Feeding NSUnarchiver bad data can cause crash
  • Index(es):
    • Date
    • Thread