aboutsummaryrefslogtreecommitdiff
path: root/test/js/node/process/process.test.js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-07-17 23:02:33 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-07-17 23:02:33 -0700
commitb760d1da30c343a98600f8693b5455e00e3f47c5 (patch)
tree03ea764840950781e0f3a508c61b3d40c2a1bfc6 /test/js/node/process/process.test.js
parent728c8fdcdb4e9276a7bd0721bad3b5d0cbed67fa (diff)
downloadbun-b760d1da30c343a98600f8693b5455e00e3f47c5.tar.gz
bun-b760d1da30c343a98600f8693b5455e00e3f47c5.tar.zst
bun-b760d1da30c343a98600f8693b5455e00e3f47c5.zip
Fix potential crash in process.dlopen()
Diffstat (limited to 'test/js/node/process/process.test.js')
-rw-r--r--test/js/node/process/process.test.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/js/node/process/process.test.js b/test/js/node/process/process.test.js
index 91479108f..539a92f2c 100644
--- a/test/js/node/process/process.test.js
+++ b/test/js/node/process/process.test.js
@@ -478,3 +478,13 @@ for (const stub of emptyArrayStubs) {
expect(process[stub]).toHaveLength(0);
});
}
+
+it("dlopen args parsing", () => {
+ expect(() => process.dlopen({ module: "42" }, "/tmp/not-found.so")).toThrow();
+ expect(() => process.dlopen({ module: 42 }, "/tmp/not-found.so")).toThrow();
+ expect(() => process.dlopen({ module: { exports: "42" } }, "/tmp/not-found.so")).toThrow();
+ expect(() => process.dlopen({ module: { exports: 42 } }, "/tmp/not-found.so")).toThrow();
+ expect(() => process.dlopen({ module: Symbol() }, "/tmp/not-found.so")).toThrow();
+ expect(() => process.dlopen({ module: { exports: Symbol("123") } }, "/tmp/not-found.so")).toThrow();
+ expect(() => process.dlopen({ module: { exports: Symbol("123") } }, Symbol("badddd"))).toThrow();
+});