Browse Source

prevent buffer merge overflow

Otso Alho 4 years ago
parent
commit
f548be3d94
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/SharpGLTF.Core/Schema2/gltf.Buffer.cs

+ 1 - 1
src/SharpGLTF.Core/Schema2/gltf.Buffer.cs

@@ -261,7 +261,7 @@ namespace SharpGLTF.Schema2
 
                 var alreadyFull = last.BufferSize >= maxSize;
                 var notEmpty = last.BufferSize > 0;
-                var bvTooBig = bv.Content.Count >= maxSize;
+                var bvTooBig = (long)bv.Content.Count + last.BufferSize >= maxSize;
 
                 if (alreadyFull || (notEmpty && bvTooBig))
                 {