Browse Source

Merge pull request #102 from Tridify/topic/prevent-merge-buffer-overflow

prevent buffer merge overflow
Vicente Penades 4 years ago
parent
commit
b4e0140ee8
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 alreadyFull = last.BufferSize >= maxSize;
                 var notEmpty = last.BufferSize > 0;
                 var notEmpty = last.BufferSize > 0;
-                var bvTooBig = bv.Content.Count >= maxSize;
+                var bvTooBig = (long)bv.Content.Count + last.BufferSize >= maxSize;
 
 
                 if (alreadyFull || (notEmpty && bvTooBig))
                 if (alreadyFull || (notEmpty && bvTooBig))
                 {
                 {