| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/common/page_state_serialization.h" | 5 #include "content/common/page_state_serialization.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/pickle.h" | 10 #include "base/pickle.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 return false; | 113 return false; |
| 114 | 114 |
| 115 size_t value_size; | 115 size_t value_size; |
| 116 if (!base::StringToSizeT(document_state[index++].string(), &value_size)) | 116 if (!base::StringToSizeT(document_state[index++].string(), &value_size)) |
| 117 return false; | 117 return false; |
| 118 | 118 |
| 119 if (index + value_size > document_state.size() || | 119 if (index + value_size > document_state.size() || |
| 120 index + value_size < index) // Check for overflow. | 120 index + value_size < index) // Check for overflow. |
| 121 return false; | 121 return false; |
| 122 | 122 |
| 123 if (EqualsASCII(type.string(), "file")) { | 123 if (base::EqualsASCII(type.string(), "file")) { |
| 124 if (value_size != 2) | 124 if (value_size != 2) |
| 125 return false; | 125 return false; |
| 126 | 126 |
| 127 referenced_files->push_back(document_state[index++]); | 127 referenced_files->push_back(document_state[index++]); |
| 128 index++; // Skip over display name. | 128 index++; // Skip over display name. |
| 129 } else { | 129 } else { |
| 130 index += value_size; | 130 index += value_size; |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 float device_scale_factor, | 749 float device_scale_factor, |
| 750 ExplodedPageState* exploded) { | 750 ExplodedPageState* exploded) { |
| 751 g_device_scale_factor_for_testing = device_scale_factor; | 751 g_device_scale_factor_for_testing = device_scale_factor; |
| 752 bool rv = DecodePageState(encoded, exploded); | 752 bool rv = DecodePageState(encoded, exploded); |
| 753 g_device_scale_factor_for_testing = 0.0; | 753 g_device_scale_factor_for_testing = 0.0; |
| 754 return rv; | 754 return rv; |
| 755 } | 755 } |
| 756 #endif | 756 #endif |
| 757 | 757 |
| 758 } // namespace content | 758 } // namespace content |
| OLD | NEW |