Browse Source

[trac838] Check the value passed to isspace() is not less than 0

Ocean Wang 14 years ago
parent
commit
c4412dfaa0
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/lib/util/encode/base_n.cc

+ 4 - 2
src/lib/util/encode/base_n.cc

@@ -174,8 +174,10 @@ public:
         return (*this);
     }
     void skipSpaces() {
-        while (base_ != base_end_ &&
-               isspace(static_cast<unsigned char>(*base_)))
+        // If *base_ < 0, on Windows platform with Visual Studio compiler
+        // it may trigger _ASSERTE((unsigned)(c + 1) <= 256);
+        // so make sure that the parameter of isspace() is larger than 0
+        while (base_ != base_end_ && ((*base_) >= 0) && isspace(*base_))
         {
             ++base_;
         }