diff options
author | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-03-03 11:43:10 +0200 |
---|---|---|
committer | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-03-03 11:43:10 +0200 |
commit | ba415b8ef4cab395c77d34e616322b8781116911 (patch) | |
tree | 884855a3f99345ff57bccbe5ae3be4e8a973d2e2 /indra/newview/llmeshrepository.cpp | |
parent | 36cb6933e6c1ad92e1887503b74a05c32988b0f1 (diff) |
SL-10422 Validate mesh
Diffstat (limited to 'indra/newview/llmeshrepository.cpp')
-rw-r--r-- | indra/newview/llmeshrepository.cpp | 12 |
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; |