mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
## Summary Fixes a segfault that occurred when calling `process.dlopen` with `null`, `undefined`, or primitive values for `exports`. Previously, this would cause a crash at address `0x00000000` in `node_module_register` due to dereferencing an uninitialized `strongExportsObject`. ## Changes - Modified `src/bun.js/bindings/v8/node.cpp` to use JSC's `toObject()` instead of manual type checking - This matches Node.js `ToObject()` behavior: - Throws `TypeError` for `null`/`undefined` - Creates wrapper objects for primitives - Preserves existing objects ## Test Plan Added `test/js/node/process/dlopen-non-object-exports.test.ts` with three test cases: - Null exports (should throw) - Undefined exports (should throw) - Primitive exports (should create wrapper) All tests pass with the fix. ## Related Issue Fixes the first bug discovered in the segfault investigation. Co-authored-by: Claude Bot <claude-bot@bun.sh> Co-authored-by: Claude <noreply@anthropic.com>