Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/node_errors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ static std::string GetErrorSource(Isolate* isolate,
: 0;
int start = message->GetStartColumn(context).FromMaybe(0);
int end = message->GetEndColumn(context).FromMaybe(0);
if (start >= script_start) {
CHECK_GE(end, start);

This comment was marked as spam.

if (start >= script_start && end >= script_start) {
start -= script_start;
end -= script_start;
}
Expand All @@ -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;
}
Expand Down
Loading