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 b6219b6

Browse filesBrowse files
semimikohaduh95
authored andcommitted
src: fix crash in GetErrorSource() for invalid using syntax
Signed-off-by: semimikoh <ejffjeosms@gmail.com> PR-URL: #62770 Fixes: #62767 Refs: https://github.com/tc39/test262 Reviewed-By: René <contact.9a5d6388@renegade334.me.uk> Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent 0e2adb3 commit b6219b6
Copy full SHA for b6219b6

1 file changed

+2-4Lines changed: 2 additions & 4 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node_errors.cc‎

Copy file name to clipboardExpand all lines: src/node_errors.cc
+2-4Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,7 @@ static std::string GetErrorSource(Isolate* isolate,
150150
: 0;
151151
int start = message->GetStartColumn();
152152
int end = message->GetEndColumn();
153-
if (start >= script_start) {
154-
CHECK_GE(end, start);
153+
if (start >= script_start && end >= script_start) {
155154
start -= script_start;
156155
end -= script_start;
157156
}
@@ -161,8 +160,7 @@ static std::string GetErrorSource(Isolate* isolate,
161160
CHECK_GT(buf.size(), 0);
162161
*added_exception_line = true;
163162

164-
if (start > end ||
165-
start < 0 ||
163+
if (start > end || start < 0 || end < 0 ||
166164
static_cast<size_t>(end) > sourceline.size()) {
167165
return buf;
168166
}

0 commit comments

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