Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 318308 - creates invalid JSON for strings with null characters
Summary: creates invalid JSON for strings with null characters
Status: RESOLVED FIXED
Alias: None
Product: Jetty
Classification: RT
Component: server (show other bugs)
Version: 8.0.0   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Greg Wilkins CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-29 08:59 EDT by Marcus Better CLA
Modified: 2010-06-29 10:14 EDT (History)
1 user (show)

See Also:


Attachments
test case (460 bytes, text/plain)
2010-06-29 09:01 EDT, Marcus Better CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus Better CLA 2010-06-29 08:59:24 EDT
org.eclipse.jetty.util.ajax.JSON produces invalid JSON for strings containing the null characeter U+0000. It puts a byte with numeric value 0 in the string, but this is not allowed in JSON according to RFC 4627. The resulting JSON is not compatible with other parsers, for example WebKit's JSON.parse() will barf on it.
Comment 1 Marcus Better CLA 2010-06-29 09:01:44 EDT
Created attachment 172995 [details]
test case

This Groovy script demonstrates the bug and compares with the Jackson generator which quotes the null byte correctly.
Comment 2 Greg Wilkins CLA 2010-06-29 10:13:51 EDT
fixed in r2057.  will be in 7.1.5.

thanks for the report.
Comment 3 Greg Wilkins CLA 2010-06-29 10:14:40 EDT
the fix will propagate to 8 soon after the 7.1.5 release