소스 검색

Fix integer overflow (#5581)

- closes https://github.com/assimp/assimp/issues/5579
Kim Kulling 1 년 전
부모
커밋
2521909b8c
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      include/assimp/fast_atof.h

+ 2 - 2
include/assimp/fast_atof.h

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