Bug 17555 – [REG2.070.0] Control characters in JSON data are invalid and should cause an exception

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-06-26T07:59:00Z
Last change time
2018-01-05T13:29:28Z
Keywords
pull
Assigned to
Vladimir Panteleev
Creator
Vladimir Panteleev

Comments

Comment #0 by dlang-bugzilla — 2017-06-26T07:59:00Z
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 by dlang-bugzilla — 2017-06-26T10:03:44Z
Comment #2 by github-bugzilla — 2017-07-03T09:07:42Z
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 by github-bugzilla — 2017-07-08T17:09:21Z
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 by github-bugzilla — 2018-01-05T13:29:28Z
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