summaryrefslogtreecommitdiff
path: root/indra/newview/llmeshrepository.cpp
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2019-02-22 21:02:51 +0200
committerandreykproductengine <andreykproductengine@lindenlab.com>2019-02-22 21:02:51 +0200
commitba8f261fdf83108cf5bc48442876916d7c32b666 (patch)
tree5fa259d083417bcc43f6eb698f9df4f20d827ef4 /indra/newview/llmeshrepository.cpp
parent86d28366b1f53f56c444e5a5ccc025cd6b136b36 (diff)
SL-10422 Validate loaded mesh
Diffstat (limited to 'indra/newview/llmeshrepository.cpp')
-rw-r--r--indra/newview/llmeshrepository.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 2e7141bcfc..c4e7b17322 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -1823,7 +1823,17 @@ bool LLMeshRepoThread::headerReceived(const LLVolumeParams& mesh_params, U8* dat
return false;
}
- header_size += stream.tellg();
+ if (!header.isMap() || !header.has("version"))
+ {
+ LL_WARNS(LOG_MESH) << "Mesh header is invalid for ID: " << mesh_id << LL_ENDL;
+ return false;
+ }
+
+ // make sure there is at least one lod, function returns -1 and marks as 404 otherwise
+ if (LLMeshRepository::getActualMeshLOD(header, 0) >= 0)
+ {
+ header_size += stream.tellg();
+ }
}
else
{
@@ -2908,9 +2918,14 @@ S32 LLMeshRepository::getActualMeshLOD(LLSD& header, S32 lod)
{
lod = llclamp(lod, 0, 3);
+ if (header.has("404"))
+ {
+ return -1;
+ }
+
S32 version = header["version"];
- if (header.has("404") || version > MAX_MESH_VERSION)
+ if (version > MAX_MESH_VERSION)
{
return -1;
}