From ba415b8ef4cab395c77d34e616322b8781116911 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Sun, 3 Mar 2019 11:43:10 +0200 Subject: SL-10422 Validate mesh --- indra/newview/llmeshrepository.cpp | 12 ++++++++---- 1 file 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; -- cgit v1.2.3