Reject files with an invalid byteLength value

pull/4211/head
Max Vollmer (Microsoft Havok) 2021-11-26 13:01:15 +00:00
parent 38382715f7
commit 0015823bef
1 changed files with 4 additions and 0 deletions

View File

@ -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);
}