Просмотр исходного кода

Limit the number of characters printed.

Malcolm Tyrrell 5 лет назад
Родитель
Сommit
17702605cf
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      include/assimp/fast_atof.h

+ 4 - 2
include/assimp/fast_atof.h

@@ -193,7 +193,8 @@ uint64_t strtoul10_64( const char* in, const char** out=0, unsigned int* max_ino
     uint64_t value = 0;
 
     if ( *in < '0' || *in > '9' ) {
-        throw DeadlyImportError("The string \"", in, "\" cannot be converted into a value." );
+        // The string is known to be bad, so don't risk printing the whole thing.
+        throw ExceptionType("The string \"", std::substr(in, 0, 100), "\" cannot be converted into a value." );
     }
 
     for ( ;; ) {
@@ -292,7 +293,8 @@ const char* fast_atoreal_move(const char* c, Real& out, bool check_comma = true)
 
     if (!(c[0] >= '0' && c[0] <= '9') &&
             !((c[0] == '.' || (check_comma && c[0] == ',')) && c[1] >= '0' && c[1] <= '9')) {
-        throw ExceptionType("Cannot parse string \"", c, 
+        // The string is known to be bad, so don't risk printing the whole thing.
+        throw ExceptionType("Cannot parse string \"", std::substr(c, 0, 100), 
                                     "\" as a real number: does not start with digit "
                                     "or decimal point followed by digit.");
     }