diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-15 19:31:23 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-15 19:31:23 +0000 |
commit | d87f8e6f287c0c8a79cf18e13a7c6debd3a77bb3 (patch) | |
tree | 1a72f502c7e0e91edaea9feac382637afb764017 /base/pickle.h | |
parent | af1c66ad268c9b8ff8c83ed9522e0a1215411917 (diff) | |
download | chromium_src-d87f8e6f287c0c8a79cf18e13a7c6debd3a77bb3.zip chromium_src-d87f8e6f287c0c8a79cf18e13a7c6debd3a77bb3.tar.gz chromium_src-d87f8e6f287c0c8a79cf18e13a7c6debd3a77bb3.tar.bz2 |
Pickle: handle invalid data on 64 bit systems.
There was a problem with pointer arithmetic for 64 bit systems
so invalid data was not properly detected. Now we do explicit tests.
BUG=56449
TEST=base_unittests
Review URL: http://codereview.chromium.org/4716006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66149 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/pickle.h')
-rw-r--r-- | base/pickle.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/base/pickle.h b/base/pickle.h index c7aee67..6006e62 100644 --- a/base/pickle.h +++ b/base/pickle.h @@ -177,10 +177,12 @@ class Pickle { // Returns the address of the byte immediately following the currently valid // header + payload. char* end_of_payload() { + // We must have a valid header_. return payload() + payload_size(); } const char* end_of_payload() const { - return payload() + payload_size(); + // This object may be invalid. + return header_ ? payload() + payload_size() : NULL; } size_t capacity() const { |