Преглед на файлове

Fix integer overflow in FastUInt32ToBufferLeft

If digits > 2, and int is 32 bit, line 999 overflows. It has been fixed
internally in CL 41203823.
Adam Michalik преди 8 години
родител
ревизия
4c5d3eddf9
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      src/google/protobuf/stubs/strutil.cc

+ 1 - 1
src/google/protobuf/stubs/strutil.cc

@@ -981,7 +981,7 @@ static const char two_ASCII_digits[100][2] = {
 };
 
 char* FastUInt32ToBufferLeft(uint32 u, char* buffer) {
-  int digits;
+  uint32 digits;
   const char *ASCII_digits = NULL;
   // The idea of this implementation is to trim the number of divides to as few
   // as possible by using multiplication and subtraction rather than mod (%),