Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Unified Diff: base/pickle.cc

Issue 9694034: Fix PickleIterator::GetReadPointerAndAdvance() not to produce wild addresses (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/pickle.cc
===================================================================
--- base/pickle.cc (revision 126350)
+++ base/pickle.cc (working copy)
@@ -45,13 +45,9 @@
}
const char* PickleIterator::GetReadPointerAndAdvance(int num_bytes) {
- const char* current_read_ptr = read_ptr_;
- const char* end_data_ptr = read_ptr_ + num_bytes;
- if (num_bytes < 0)
+ if (num_bytes < 0 || read_end_ptr_ - read_ptr_ < num_bytes)
jbates 2012/03/13 16:52:44 Much cleaner!
return NULL;
- // Check for enough space and for wrapping.
- if (end_data_ptr > read_end_ptr_ || end_data_ptr < current_read_ptr)
- return NULL;
+ const char* current_read_ptr = read_ptr_;
read_ptr_ += AlignInt(num_bytes, sizeof(uint32));
return current_read_ptr;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698