Fix integer overflow (#5581)

- closes https://github.com/assimp/assimp/issues/5579
pull/5582/head^2
Kim Kulling 2024-05-18 19:05:10 +02:00 committed by GitHub
parent 04afb63d34
commit 2521909b8c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -150,7 +150,7 @@ inline uint8_t HexOctetToDecimal(const char* in) {
// ------------------------------------------------------------------------------------
// signed variant of strtoul10
// ------------------------------------------------------------------------------------
inline int strtol10( const char* in, const char** out=0) {
inline int strtol10( const char* in, const char** out = 0) {
bool inv = (*in=='-');
if ( inv || *in == '+' ) {
++in;
@ -158,7 +158,7 @@ inline int strtol10( const char* in, const char** out=0) {
int value = strtoul10(in,out);
if (inv) {
if (value < INT_MAX) {
if (value < INT_MAX && value > INT_MIN) {
value = -value;
} else {
ASSIMP_LOG_WARN( "Converting the string \"", in, "\" into an inverted value resulted in overflow." );