diff options
author | 2023-09-20 22:50:10 -0300 | |
---|---|---|
committer | 2023-09-20 18:50:10 -0700 | |
commit | b65862e23b255d2ebf6df8cd32481e5162c7f978 (patch) | |
tree | 1d8bbbef70f3a46b3e290d0e9832ee2f97455b71 /src/bun.js | |
parent | 5f66b4e729105286863a13955b1ed8897b45210e (diff) | |
download | bun-b65862e23b255d2ebf6df8cd32481e5162c7f978.tar.gz bun-b65862e23b255d2ebf6df8cd32481e5162c7f978.tar.zst bun-b65862e23b255d2ebf6df8cd32481e5162c7f978.zip |
fix(ffi) fix size limit for dlopen (#5516)
* fix size limit
* 63
* throw error
* ffi.test.js
* add macos tests
* oops
Diffstat (limited to 'src/bun.js')
-rw-r--r-- | src/bun.js/api/ffi.zig | 8 | ||||
-rw-r--r-- | src/bun.js/bindings/bindings.zig | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/bun.js/api/ffi.zig b/src/bun.js/api/ffi.zig index 097b66d35..234b58888 100644 --- a/src/bun.js/api/ffi.zig +++ b/src/bun.js/api/ffi.zig @@ -317,8 +317,12 @@ pub const FFI = struct { }; }; }; - - var obj = JSC.JSValue.createEmptyObject(global, symbols.values().len); + + var size = symbols.values().len; + if(size >= 63) { + size = 0; + } + var obj = JSC.JSValue.createEmptyObject(global, size); obj.protect(); defer obj.unprotect(); for (symbols.values()) |*function| { diff --git a/src/bun.js/bindings/bindings.zig b/src/bun.js/bindings/bindings.zig index 72393d639..3a0b369e9 100644 --- a/src/bun.js/bindings/bindings.zig +++ b/src/bun.js/bindings/bindings.zig @@ -3527,7 +3527,7 @@ pub const JSValue = enum(JSValueReprInt) { } pub fn createEmptyObject(global: *JSGlobalObject, len: usize) JSValue { - std.debug.assert(len <= 64); // max inline capacity JSC allows is 64. If you run into this, just set it to 0. + std.debug.assert(len <= 63); // max inline capacity JSC allows is 63. If you run into this, just set it to 0. return cppFn("createEmptyObject", .{ global, len }); } |