Description
createNativeArrayBuffer(double) casts its JavaScript number directly to size_t. Negative, non-finite, and values beyond the platform size limit can therefore become huge allocations or enter an out-of-range floating-to-integer conversion.
Reproduction
Call NitroModules.createNativeArrayBuffer(-1), Infinity, or Number.MAX_VALUE. Current native code reaches the unchecked allocation path.
Expected behavior
Invalid sizes should reject deterministically before conversion or allocation.
Description
createNativeArrayBuffer(double)casts its JavaScript number directly tosize_t. Negative, non-finite, and values beyond the platform size limit can therefore become huge allocations or enter an out-of-range floating-to-integer conversion.Reproduction
Call
NitroModules.createNativeArrayBuffer(-1),Infinity, orNumber.MAX_VALUE. Current native code reaches the unchecked allocation path.Expected behavior
Invalid sizes should reject deterministically before conversion or allocation.