File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -56,19 +56,18 @@ static std::string GetErrorSource(Isolate* isolate,
56
56
MaybeLocal<String> source_line_maybe = message->GetSourceLine (context);
57
57
node::Utf8Value encoded_source (isolate, source_line_maybe.ToLocalChecked ());
58
58
std::string sourceline (*encoded_source, encoded_source.length ());
59
+ *added_exception_line = false ;
59
60
60
61
// If source maps have been enabled, the exception line will instead be
61
62
// added in the JavaScript context:
62
63
Environment* env = Environment::GetCurrent (isolate);
63
64
const bool has_source_map_url =
64
65
!message->GetScriptOrigin ().SourceMapUrl ().IsEmpty ();
65
66
if (has_source_map_url && env->source_maps_enabled ()) {
66
- *added_exception_line = false ;
67
67
return sourceline;
68
68
}
69
69
70
70
if (sourceline.find (" node-do-not-add-exception-line" ) != std::string::npos) {
71
- *added_exception_line = false ;
72
71
return sourceline;
73
72
}
74
73
@@ -116,6 +115,12 @@ static std::string GetErrorSource(Isolate* isolate,
116
115
sourceline.c_str ());
117
116
CHECK_GT (buf.size (), 0 );
118
117
118
+ if (start >= end ||
119
+ start < 0 ||
120
+ static_cast <size_t >(end) > sourceline.size ()) {
121
+ return buf;
122
+ }
123
+
119
124
constexpr int kUnderlineBufsize = 1020 ;
120
125
char underline_buf[kUnderlineBufsize + 4 ];
121
126
int off = 0 ;
You can’t perform that action at this time.
0 commit comments