Index: base/pickle.cc |
=================================================================== |
--- base/pickle.cc (revision 19191) |
+++ base/pickle.cc (working copy) |
@@ -208,6 +208,9 @@ |
int len; |
if (!ReadLength(iter, &len)) |
return false; |
+ // Avoid integer overflow. |
+ if (len > INT_MAX / static_cast<int>(sizeof(wchar_t))) |
+ return false; |
if (!IteratorHasRoomFor(*iter, len * sizeof(wchar_t))) |
return false; |
@@ -224,7 +227,7 @@ |
int len; |
if (!ReadLength(iter, &len)) |
return false; |
- if (!IteratorHasRoomFor(*iter, len)) |
+ if (!IteratorHasRoomFor(*iter, len * sizeof(char16))) |
return false; |
char16* chars = reinterpret_cast<char16*>(*iter); |