mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
src: fix crash in GetErrorSource() for invalid using syntax
Signed-off-by: semimikoh <ejffjeosms@gmail.com> PR-URL: https://github.com/nodejs/node/pull/62770 Fixes: https://github.com/nodejs/node/issues/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>
This commit is contained in:
1 parent
3d6584005c
commit
4247cd305b
1 file changed
+2
-4
+2
-4
@@ -150,8 +150,7 @@ static std::string GetErrorSource(Isolate* isolate,
|
||||
: 0;
|
||||
int start = message->GetStartColumn();
|
||||
int end = message->GetEndColumn();
|
||||
if (start >= script_start) {
|
||||
CHECK_GE(end, start);
|
||||
if (start >= script_start && end >= script_start) {
|
||||
start -= script_start;
|
||||
end -= script_start;
|
||||
}
|
||||
@@ -161,8 +160,7 @@ static std::string GetErrorSource(Isolate* isolate,
|
||||
CHECK_GT(buf.size(), 0);
|
||||
*added_exception_line = true;
|
||||
|
||||
if (start > end ||
|
||||
start < 0 ||
|
||||
if (start > end || start < 0 || end < 0 ||
|
||||
static_cast<size_t>(end) > sourceline.size()) {
|
||||
return buf;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user