Skip to content

Commit dcc704d

Browse files
Roland Takacsegavrin
authored andcommitted
Add missing case for backspace control character in JSON.parse()
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs [email protected]
1 parent 8aeb2a0 commit dcc704d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

jerry-core/ecma/builtin-objects/ecma-builtin-json.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ ecma_builtin_json_parse_string (ecma_json_token_t *token_p) /**< token argument
163163
*current_p = '\t';
164164
break;
165165
}
166+
case 'b':
167+
{
168+
*current_p = '\b';
169+
break;
170+
}
166171
default:
167172
{
168173
return;

tests/jerry/json-parse.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ str = '-32.5e002';
3838
assert (JSON.parse (str) == -3250);
3939
str = '"str"';
4040
assert (JSON.parse (str) == "str");
41+
str = '"\\b\\f\\n\\t\\r"'
42+
assert (JSON.parse (str) === "\b\f\n\t\r");
4143

4244
check_parse_error ('undefined');
4345
check_parse_error ('falses');

0 commit comments

Comments
 (0)