diff --git a/src/node_errors.cc b/src/node_errors.cc index a2ece94b938c21..74326496132773 100644 --- a/src/node_errors.cc +++ b/src/node_errors.cc @@ -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(end) > sourceline.size()) { return buf; }