| Issue 69: | Deserializing a non-UT8 string causes a crash | |
| 3 people starred this issue and may be notified of changes. | Back to list |
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
Status:
WontFix
Apr 2, 2010
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. |