From fe86e03cda9f172b2352d9350e273104aaf13ff8 Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Thu, 15 Dec 2022 17:24:48 -0500 Subject: [PATCH 1/2] Don't merge buffers if greater than fs write maximum of 2147479552 --- lib/createGltf.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/createGltf.js b/lib/createGltf.js index 6bdf34a..3d07008 100644 --- a/lib/createGltf.js +++ b/lib/createGltf.js @@ -1,5 +1,7 @@ "use strict"; -const BUFFER_MAX_BYTE_LENGTH = require("buffer").constants.MAX_LENGTH; +const FS_WRITE_MAX_LENGTH = 2147479552; // See https://github.com/nodejs/node/issues/35605 +const BUFFER_MAX_LENGTH = require("buffer").constants.MAX_LENGTH; +const BUFFER_MAX_BYTE_LENGTH = Math.min(FS_WRITE_MAX_LENGTH, BUFFER_MAX_LENGTH); const Cesium = require("cesium"); const getBufferPadded = require("./getBufferPadded"); const getDefaultMaterial = require("./loadMtl").getDefaultMaterial; From 6ab0dc139b91c6d1c9a242ebb994a7e1276b243c Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Wed, 25 Jan 2023 16:03:59 -0500 Subject: [PATCH 2/2] Update CHANGES.md --- CHANGES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 842f287..919cf37 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # Change Log +### 3.1.5 - ????-??-?? + +- Fixed crash when writing GLB files above 2GB. [#280](https://github.com/CesiumGS/obj2gltf/pull/280) + ### 3.1.4 - 2021-10-15 - Unlocked CesiumJS package now that CesiumJS 1.86.1 is released with a fix for Node 16. [#270](https://github.com/CesiumGS/obj2gltf/pull/270)