safety: audit and add missing exception checks to JSC::constructArray+constructEmptyArray (#20119)

This commit is contained in:
Meghan Denny
2025-05-31 19:05:02 -08:00
committed by GitHub
parent 5a025abddf
commit 284de53f26
72 changed files with 341 additions and 329 deletions

View File

@@ -476,6 +476,7 @@ JSC::JSValue resolveLookupPaths(JSC::JSGlobalObject* globalObject, String reques
)) {
if (parent.paths) {
auto array = JSC::constructArray(globalObject, (ArrayAllocationProfile*)nullptr, nullptr, 0);
RETURN_IF_EXCEPTION(scope, {});
auto len = parent.paths->length();
for (size_t i = 0; i < len; i++) {
auto path = parent.paths->getIndex(globalObject, i);
@@ -490,6 +491,7 @@ JSC::JSValue resolveLookupPaths(JSC::JSGlobalObject* globalObject, String reques
RELEASE_AND_RETURN(scope, paths);
} else {
auto array = JSC::constructEmptyArray(globalObject, nullptr, 0);
RETURN_IF_EXCEPTION(scope, {});
RELEASE_AND_RETURN(scope, array);
}
}
@@ -510,6 +512,7 @@ JSC::JSValue resolveLookupPaths(JSC::JSGlobalObject* globalObject, String reques
JSValue values[] = { dirname };
auto array = JSC::constructArray(globalObject, (ArrayAllocationProfile*)nullptr, values, 1);
RETURN_IF_EXCEPTION(scope, {});
RELEASE_AND_RETURN(scope, array);
}