| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/pickle.h" | 5 #include "base/pickle.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include <algorithm> // for max() | 9 #include <algorithm> // for max() |
| 10 | 10 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 83 } |
| 84 | 84 |
| 85 bool PickleIterator::ReadInt64(int64* result) { | 85 bool PickleIterator::ReadInt64(int64* result) { |
| 86 return ReadBuiltinType(result); | 86 return ReadBuiltinType(result); |
| 87 } | 87 } |
| 88 | 88 |
| 89 bool PickleIterator::ReadUInt64(uint64* result) { | 89 bool PickleIterator::ReadUInt64(uint64* result) { |
| 90 return ReadBuiltinType(result); | 90 return ReadBuiltinType(result); |
| 91 } | 91 } |
| 92 | 92 |
| 93 bool PickleIterator::ReadUIntPtr(uintptr_t* result) { |
| 94 return ReadBuiltinType(result); |
| 95 } |
| 96 |
| 93 bool PickleIterator::ReadFloat(float* result) { | 97 bool PickleIterator::ReadFloat(float* result) { |
| 94 return ReadBuiltinType(result); | 98 return ReadBuiltinType(result); |
| 95 } | 99 } |
| 96 | 100 |
| 97 bool PickleIterator::ReadString(std::string* result) { | 101 bool PickleIterator::ReadString(std::string* result) { |
| 98 int len; | 102 int len; |
| 99 if (!ReadInt(&len)) | 103 if (!ReadInt(&len)) |
| 100 return false; | 104 return false; |
| 101 const char* read_from = GetReadPointerAndAdvance(len); | 105 const char* read_from = GetReadPointerAndAdvance(len); |
| 102 if (!read_from) | 106 if (!read_from) |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 return NULL; | 356 return NULL; |
| 353 | 357 |
| 354 const Header* hdr = reinterpret_cast<const Header*>(start); | 358 const Header* hdr = reinterpret_cast<const Header*>(start); |
| 355 const char* payload_base = start + header_size; | 359 const char* payload_base = start + header_size; |
| 356 const char* payload_end = payload_base + hdr->payload_size; | 360 const char* payload_end = payload_base + hdr->payload_size; |
| 357 if (payload_end < payload_base) | 361 if (payload_end < payload_base) |
| 358 return NULL; | 362 return NULL; |
| 359 | 363 |
| 360 return (payload_end > end) ? NULL : payload_end; | 364 return (payload_end > end) ? NULL : payload_end; |
| 361 } | 365 } |
| OLD | NEW |