From 81f85a6f938f8c7bfd6155639589ae2aee0331d1 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Mon, 5 Dec 2022 13:07:52 +0100 Subject: [PATCH] Avoid undefined-shift in Assimp::ASE::Parser::ParseLV4MeshFace. --- code/AssetLib/ASE/ASEParser.cpp | 8 +++++++- code/AssetLib/ASE/ASEParser.h | 9 +++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/code/AssetLib/ASE/ASEParser.cpp b/code/AssetLib/ASE/ASEParser.cpp index 96346bdcb..839d308de 100644 --- a/code/AssetLib/ASE/ASEParser.cpp +++ b/code/AssetLib/ASE/ASEParser.cpp @@ -1774,7 +1774,13 @@ void Parser::ParseLV4MeshFace(ASE::Face &out) { // FIX: There needn't always be a value, sad but true while (true) { if (*filePtr < '9' && *filePtr >= '0') { - out.iSmoothGroup |= (1 << strtoul10(filePtr, &filePtr)); + uint32_t value = strtoul10(filePtr, &filePtr); + if (value < 32) { + out.iSmoothGroup |= (1 << strtoul10(filePtr, &filePtr)); + } else { + const std::string message = std::string("Unable to set smooth group, value with ") + ai_to_string(value) + std::string(" out of range"); + LogWarning(message.c_str()); + } } SkipSpaces(&filePtr); if (',' != *filePtr) { diff --git a/code/AssetLib/ASE/ASEParser.h b/code/AssetLib/ASE/ASEParser.h index 8cda32f24..79cb43f89 100644 --- a/code/AssetLib/ASE/ASEParser.h +++ b/code/AssetLib/ASE/ASEParser.h @@ -4,7 +4,6 @@ Open Asset Import Library (assimp) Copyright (c) 2006-2022, assimp team - All rights reserved. Redistribution and use of this software in source and binary forms, @@ -385,12 +384,10 @@ struct Dummy : public BaseNode { /** \brief Class to parse ASE files */ class Parser { -private: - Parser() AI_NO_EXCEPT { - // empty - } - public: + /// @brief No default constructor. + Parser() AI_NO_EXCEPT = delete + // ------------------------------------------------------------------- //! Construct a parser from a given input file which is //! guaranteed to be terminated with zero.