CesiumGS / obj2gltf

Convert OBJ assets to glTF
Apache License 2.0
1.7k stars 307 forks source link

Don't merge buffers if final buffer exceeds fs.write maximum of `2147479552` bytes #280

Closed lilleyse closed 1 year ago

lilleyse commented 1 year ago

We have a couple areas in obj2gltf and gltf-pipeline that prevent merging buffers if the combined buffer would be greater than Node's maximum buffer size. This size was increased to 4,294,967,296 (2^32) bytes a little while back for 64-bit platforms.

The problem is fs.write has a separate maximum of 2,147,479,552 bytes which is the limit of the Linux write syscall. Node will throw an error if the buffer being written is greater than that value (actually, it checks if the value is a valid Int32 which is a slightly larger value).

So really we need to observe the fs.write limit.

See also: https://github.com/CesiumGS/gltf-pipeline/pull/627