On 26 Feb 2013, at 4:20 pm, Graham Cox wrote:

> I would hesitate to suggest it, but if you are routinely storing NSNull (or 
> @"$null") in arrays, it might point to a flaw in your own design.

As someone pointed out earlier, this bug makes NSKeyedArchiver unusable for any 
data model that contains user-entered strings.  For round-trip behaviour, *all* 
NSString values passed through NSKeyedArchiver must be filtered on the way in 
and on the way out.

Sure enough, I just discovered that one of my apps--whose file format is about 
eight years old and (perhaps unfortunately) based around NSKeyedArchiver--is 
vulnerable to this bug.  Enter the string "$null" into any text field in the 
doc, save, and that doc will never open again.  (Clearly this points to another 
bug in my own code--an exception is raised due to a nil string being assigned 
to an NSTextFieldCell--but proves that the magic string "$null" has been turned 
into nothingness.)

b

--
Ben Kennedy, chief magician
Zygoat Creative Technical Services
http://www.zygoat.ca


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to