summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2019-03-03 11:43:10 +0200
committerandreykproductengine <andreykproductengine@lindenlab.com>2019-03-03 11:43:10 +0200
commit2fc7a511db14e693cf02ee3f6d1fdd49d203ad8d (patch)
tree78cb107dcb8fc66402a00ee1dc928a7a9a92011b
parent0abd3cfc9c6a7910c6628cf2863af3c6e71e0c4d (diff)
SL-10422 Validate mesh
-rw-r--r--indra/newview/llmeshrepository.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index c4e7b17322..38fd2d777e 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -1823,14 +1823,19 @@ bool LLMeshRepoThread::headerReceived(const LLVolumeParams& mesh_params, U8* dat
return false;
}
- if (!header.isMap() || !header.has("version"))
+ if (!header.isMap())
{
LL_WARNS(LOG_MESH) << "Mesh header is invalid for ID: " << mesh_id << LL_ENDL;
return false;
}
+ if (header.has("version") && header["version"].asInteger() > MAX_MESH_VERSION)
+ {
+ LL_INFOS(LOG_MESH) << "Wrong version in header for " << mesh_id << LL_ENDL;
+ header["404"] = 1;
+ }
// make sure there is at least one lod, function returns -1 and marks as 404 otherwise
- if (LLMeshRepository::getActualMeshLOD(header, 0) >= 0)
+ else if (LLMeshRepository::getActualMeshLOD(header, 0) >= 0)
{
header_size += stream.tellg();
}
@@ -3172,8 +3177,7 @@ void LLMeshHeaderHandler::processData(LLCore::BufferArray * /* body */, S32 /* b
if (header_bytes > 0
&& !header.has("404")
- && header.has("version")
- && header["version"].asInteger() <= MAX_MESH_VERSION)
+ && (!header.has("version") || header["version"].asInteger() <= MAX_MESH_VERSION))
{
std::stringstream str;