Explorar el Código

Reject files with an invalid byteLength value

Max Vollmer (Microsoft Havok) hace 3 años
padre
commit
0015823bef
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  1. 4 0
      code/AssetLib/glTF2/glTF2Asset.inl

+ 4 - 0
code/AssetLib/glTF2/glTF2Asset.inl

@@ -600,6 +600,10 @@ inline void Buffer::Read(Value &obj, Asset &r) {
 inline bool Buffer::LoadFromStream(IOStream &stream, size_t length, size_t baseOffset) {
     byteLength = length ? length : stream.FileSize();
 
+    if (byteLength > stream.FileSize()) {
+        throw DeadlyImportError("GLTF: Invalid byteLength exceeds size of actual data.");
+    }
+
     if (baseOffset) {
         stream.Seek(baseOffset, aiOrigin_SET);
     }