Index: base/pickle.cc |
=================================================================== |
--- base/pickle.cc (revision 232266) |
+++ base/pickle.cc (working copy) |
@@ -35,7 +35,7 @@ |
template<typename Type> |
inline const char* PickleIterator::GetReadPointerAndAdvance() { |
const char* current_read_ptr = read_ptr_; |
- if (read_ptr_ + sizeof(Type) > read_end_ptr_) |
+ if (sizeof(Type) > static_cast<size_t>(read_end_ptr_ - read_ptr_)) |
return NULL; |
if (sizeof(Type) < sizeof(uint32)) |
read_ptr_ += AlignInt(sizeof(Type), sizeof(uint32)); |
@@ -291,11 +291,10 @@ |
const Header* hdr = reinterpret_cast<const Header*>(start); |
const char* payload_base = start + header_size; |
- const char* payload_end = payload_base + hdr->payload_size; |
- if (payload_end < payload_base) |
+ if (hdr->payload_size > static_cast<size_t>(end - payload_base)) |
return NULL; |
- return (payload_end > end) ? NULL : payload_end; |
+ return payload_base + hdr->payload_size; |
} |
template <size_t length> void Pickle::WriteBytesStatic(const void* data) { |