D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 17555 - [REG2.070.0] Control characters in JSON data are invalid and should cause an exception
Summary: [REG2.070.0] Control characters in JSON data are invalid and should cause an ...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: Vladimir Panteleev
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2017-06-26 07:59 UTC by Vladimir Panteleev
Modified: 2018-01-05 13:29 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Vladimir Panteleev 2017-06-26 07:59:00 UTC
As per the JSON spec, raw control characters are not allowed in Unicode data. D correctly threw upon encountering them before 2.070.0.

Test case:

//////////////// test.d ////////////////
import std.exception;
import std.json;

void main()
{
    assertThrown(parseJSON("\"a\nb\""));
}
////////////////////////////////////////

After 2.070, parseJSON returns nonsense data: 

writeln(parseJSON("\"a\nb\"").str)

produces:

a\u000Ab

(i.e. the characters are "escaped" despite being decoded, not encoded).

Introduced in https://github.com/dlang/phobos/pull/3872
Comment 1 Vladimir Panteleev 2017-06-26 10:03:44 UTC
https://github.com/dlang/phobos/pull/5511
Comment 2 github-bugzilla 2017-07-03 09:07:42 UTC
Commit pushed to stable at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/55aa34e4407cd24a29f5e271a3fa318d56acf487
Fix Issue 17555 - [REG2.070.0] Control characters in JSON data are invalid and should cause an exception
Comment 3 github-bugzilla 2017-07-08 17:09:21 UTC
Commit pushed to master at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/55aa34e4407cd24a29f5e271a3fa318d56acf487
Fix Issue 17555 - [REG2.070.0] Control characters in JSON data are invalid and should cause an exception
Comment 4 github-bugzilla 2018-01-05 13:29:28 UTC
Commit pushed to dmd-cxx at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/55aa34e4407cd24a29f5e271a3fa318d56acf487
Fix Issue 17555 - [REG2.070.0] Control characters in JSON data are invalid and should cause an exception