summaryrefslogtreecommitdiff
path: root/indra/newview/llgltfmateriallist.cpp
diff options
context:
space:
mode:
authorHoward Stearns <howard.stearns@gmail.com>2022-09-02 16:01:38 -0700
committerHoward Stearns <howard.stearns@gmail.com>2022-09-02 16:01:38 -0700
commitcf8e1b2ac4614c0b4f8211f980214f5e823a672c (patch)
treec9a00501f3535d36bb00298455ee8ec2d92cce7e /indra/newview/llgltfmateriallist.cpp
parent013a7130011f72ab0c124dba87376b9862a95461 (diff)
SL-17967 - do not crash on zero-sized materials
Diffstat (limited to 'indra/newview/llgltfmateriallist.cpp')
-rw-r--r--indra/newview/llgltfmateriallist.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp
index af00cdd05f..b2d223a3e8 100644
--- a/indra/newview/llgltfmateriallist.cpp
+++ b/indra/newview/llgltfmateriallist.cpp
@@ -56,9 +56,16 @@ LLGLTFMaterial* LLGLTFMaterialList::getMaterial(const LLUUID& id)
}
LLFileSystem file(id, asset_type, LLFileSystem::READ);
+ auto size = file.getSize();
+ if (!size)
+ {
+ LL_DEBUGS() << "Zero size material." << LL_ENDL;
+ mat->unref();
+ return;
+ }
std::vector<char> buffer;
- buffer.resize(file.getSize());
+ buffer.resize(size);
file.read((U8*)&buffer[0], buffer.size());
LLSD asset;