Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a056840

Browse filesBrowse files
legendecasdanielleadams
authored andcommitted
src: fix json utils escapes for U+000B
PR-URL: #43206 Fixes: #43193 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 71802c3 commit a056840
Copy full SHA for a056840

File tree

Expand file treeCollapse file tree

2 files changed

+10
-10
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-10
lines changed
Open diff view settings
Collapse file

‎src/json_utils.cc‎

Copy file name to clipboardExpand all lines: src/json_utils.cc
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ namespace node {
55
std::string EscapeJsonChars(const std::string& str) {
66
const std::string control_symbols[0x20] = {
77
"\\u0000", "\\u0001", "\\u0002", "\\u0003", "\\u0004", "\\u0005",
8-
"\\u0006", "\\u0007", "\\b", "\\t", "\\n", "\\v", "\\f", "\\r",
9-
"\\u000e", "\\u000f", "\\u0010", "\\u0011", "\\u0012", "\\u0013",
10-
"\\u0014", "\\u0015", "\\u0016", "\\u0017", "\\u0018", "\\u0019",
11-
"\\u001a", "\\u001b", "\\u001c", "\\u001d", "\\u001e", "\\u001f"
12-
};
8+
"\\u0006", "\\u0007", "\\b", "\\t", "\\n", "\\u000b",
9+
"\\f", "\\r", "\\u000e", "\\u000f", "\\u0010", "\\u0011",
10+
"\\u0012", "\\u0013", "\\u0014", "\\u0015", "\\u0016", "\\u0017",
11+
"\\u0018", "\\u0019", "\\u001a", "\\u001b", "\\u001c", "\\u001d",
12+
"\\u001e", "\\u001f"};
1313

1414
std::string ret;
1515
size_t last_pos = 0;
Collapse file

‎test/cctest/test_json_utils.cc‎

Copy file name to clipboardExpand all lines: test/cctest/test_json_utils.cc
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ TEST(JSONUtilsTest, EscapeJsonChars) {
1212

1313
const std::string expected[0x20] = {
1414
"\\u0000", "\\u0001", "\\u0002", "\\u0003", "\\u0004", "\\u0005",
15-
"\\u0006", "\\u0007", "\\b", "\\t", "\\n", "\\v", "\\f", "\\r",
16-
"\\u000e", "\\u000f", "\\u0010", "\\u0011", "\\u0012", "\\u0013",
17-
"\\u0014", "\\u0015", "\\u0016", "\\u0017", "\\u0018", "\\u0019",
18-
"\\u001a", "\\u001b", "\\u001c", "\\u001d", "\\u001e", "\\u001f"
19-
};
15+
"\\u0006", "\\u0007", "\\b", "\\t", "\\n", "\\u000b",
16+
"\\f", "\\r", "\\u000e", "\\u000f", "\\u0010", "\\u0011",
17+
"\\u0012", "\\u0013", "\\u0014", "\\u0015", "\\u0016", "\\u0017",
18+
"\\u0018", "\\u0019", "\\u001a", "\\u001b", "\\u001c", "\\u001d",
19+
"\\u001e", "\\u001f"};
2020
for (int i = 0; i < 0x20; ++i) {
2121
char symbols[1] = { static_cast<char>(i) };
2222
std::string input(symbols, 1);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.