Version
main
Platform
Subsystem
ffi
What steps will reproduce the bug?
import { toBuffer, toArrayBuffer } from 'node:ffi';
try { toBuffer(1n, 2 ** 50); } catch (e) { console.log(e.code); }
try { toArrayBuffer(1n, 2 ** 50); } catch (e) { console.log(e.code); }
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
Both calls throw a catchable ERR_MEMORY_ALLOCATION_FAILED, as ffi.toBuffer() already does:
ERR_MEMORY_ALLOCATION_FAILED
ERR_MEMORY_ALLOCATION_FAILED
What do you see instead?
ffi.toBuffer() throws, but ffi.toArrayBuffer() aborts the process (exit code 134):
ERR_MEMORY_ALLOCATION_FAILED
FATAL ERROR: v8::ArrayBuffer::NewBackingStore Allocation failed - process out of memory
Additional information
No response
Version
main
Platform
Subsystem
ffi
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
Both calls throw a catchable
ERR_MEMORY_ALLOCATION_FAILED, asffi.toBuffer()already does:What do you see instead?
ffi.toBuffer()throws, butffi.toArrayBuffer()aborts the process (exit code 134):Additional information
No response