From 2521909b8c2a6895eeb838b8aafc65c1777525bc Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sat, 18 May 2024 19:05:10 +0200 Subject: [PATCH] Fix integer overflow (#5581) - closes https://github.com/assimp/assimp/issues/5579 --- include/assimp/fast_atof.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/assimp/fast_atof.h b/include/assimp/fast_atof.h index f2d179d60..0e8339643 100644 --- a/include/assimp/fast_atof.h +++ b/include/assimp/fast_atof.h @@ -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." );