My favorites | Sign in
Project Home
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 69: Deserializing a non-UT8 string causes a crash
3 people starred this issue and may be notified of changes. Back to list
Status:  WontFix
Owner:  ----
Closed:  Mar 2010


 
Reported by deanbro...@gmail.com, Dec 10, 2009
What steps will reproduce the problem?

NSData *theData = [@"{'will_crash':'ยข'}"
dataUsingEncoding:NSISOLatin1StringEncoding];
NSDictionary *parsedData = [[CJSONDeserializer deserializer]
deserializeAsDictionary:theData error:nil];


What is the expected output? What do you see instead?

parsedData should be nil instead of crashing.


What version of the product are you using? On what operating system?

May 2009 (latest).


Please provide any additional information below.

The crash actually takes place in CJSONScanner's
scanJSONStringConstant:error:.  [self
scanNotQuoteCharactersIntoString:&theStringChunk] causes &theStringChunk to
be nil.  The next line, [theString appendString:theStringChunk], then crashes.

Mar 19, 2010
Project Member #1 jwight
Please only decode UTF-8 strings. The default encoding (according to RFC4627) is UTF-8 anyhow.
Status: WontFix
Apr 2, 2010
#2 nuthatch
Unfortunately touchcode crashes on malformed UTF-8 as well. As a client I can't control well-formedness. I'm 
currently looking for a JSON parser that does't unceremoniously crash given bad character codes. I'd rather have 
one invalid key or value than nothing at all.

Powered by Google Project Hosting