OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/tracing/core/proto_utils.h" | 5 #include "components/tracing/core/proto_utils.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/sys_byteorder.h" | 9 #include "base/sys_byteorder.h" |
10 | 10 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 *field_intvalue = base::ByteSwapToLE32(tmp); | 67 *field_intvalue = base::ByteSwapToLE32(tmp); |
68 pos += sizeof(uint32_t); | 68 pos += sizeof(uint32_t); |
69 break; | 69 break; |
70 } | 70 } |
71 case kFieldTypeVarInt: { | 71 case kFieldTypeVarInt: { |
72 pos = ParseVarInt(pos, end, field_intvalue); | 72 pos = ParseVarInt(pos, end, field_intvalue); |
73 break; | 73 break; |
74 } | 74 } |
75 case kFieldTypeLengthDelimited: { | 75 case kFieldTypeLengthDelimited: { |
76 pos = ParseVarInt(pos, end, field_intvalue); | 76 pos = ParseVarInt(pos, end, field_intvalue); |
| 77 CHECK_LE(*field_intvalue, kMaxMessageLength); |
77 pos += *field_intvalue; | 78 pos += *field_intvalue; |
78 CHECK_PTR_LE(pos, end); | 79 CHECK_PTR_LE(pos, end); |
79 break; | 80 break; |
80 } | 81 } |
81 default: | 82 default: |
82 NOTREACHED() << "Unsupported proto field type " << *field_type; | 83 NOTREACHED() << "Unsupported proto field type " << *field_type; |
83 } | 84 } |
84 return pos; | 85 return pos; |
85 } | 86 } |
86 | 87 |
87 } // namespace proto | 88 } // namespace proto |
88 } // namespace v2 | 89 } // namespace v2 |
89 } // namespace tracing | 90 } // namespace tracing |
OLD | NEW |