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 808a456

Browse filesBrowse files
cjihrigtargos
authored andcommitted
src: use checked allocations in WASI::New()
PR-URL: #30809 Refs: #30257 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
1 parent bb8b11f commit 808a456
Copy full SHA for 808a456

File tree

Expand file treeCollapse file tree

1 file changed

+3
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-1
lines changed
Open diff view settings
Collapse file

‎src/node_wasi.cc‎

Copy file name to clipboardExpand all lines: src/node_wasi.cc
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void WASI::New(const FunctionCallbackInfo<Value>& args) {
133133
Local<Array> preopens = args[2].As<Array>();
134134
CHECK_EQ(preopens->Length() % 2, 0);
135135
options.preopenc = preopens->Length() / 2;
136-
options.preopens = UncheckedCalloc<uvwasi_preopen_t>(options.preopenc);
136+
options.preopens = Calloc<uvwasi_preopen_t>(options.preopenc);
137137
int index = 0;
138138
for (uint32_t i = 0; i < preopens->Length(); i += 2) {
139139
auto mapped = preopens->Get(context, i).ToLocalChecked();
@@ -143,7 +143,9 @@ void WASI::New(const FunctionCallbackInfo<Value>& args) {
143143
node::Utf8Value mapped_path(env->isolate(), mapped);
144144
node::Utf8Value real_path(env->isolate(), real);
145145
options.preopens[index].mapped_path = strdup(*mapped_path);
146+
CHECK_NOT_NULL(options.preopens[index].mapped_path);
146147
options.preopens[index].real_path = strdup(*real_path);
148+
CHECK_NOT_NULL(options.preopens[index].real_path);
147149
index++;
148150
}
149151

0 commit comments

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