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

Side by Side Diff: runtime/vm/kernel.cc

Issue 2794113003: VM [KERNEL] Fix a buffer overflow in COMPARE_NAME (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/kernel.h" 5 #include "vm/kernel.h"
6 6
7 #if !defined(DART_PRECOMPILED_RUNTIME) 7 #if !defined(DART_PRECOMPILED_RUNTIME)
8 namespace dart { 8 namespace dart {
9 9
10 namespace kernel { 10 namespace kernel {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 73 }
74 74
75 75
76 bool CanonicalName::IsMember() { 76 bool CanonicalName::IsMember() {
77 return IsConstructor() || IsField() || IsProcedure(); 77 return IsConstructor() || IsField() || IsProcedure();
78 } 78 }
79 79
80 80
81 // Note the two occurrences of the parameter 'literal'. 81 // Note the two occurrences of the parameter 'literal'.
82 #define COMPARE_NAME(canonical_name, literal) \ 82 #define COMPARE_NAME(canonical_name, literal) \
83 memcmp((canonical_name)->name()->buffer(), (literal), strlen(literal)) == 0 83 ((canonical_name)->name()->size() == strlen(literal) && \
84 memcmp((canonical_name)->name()->buffer(), (literal), strlen(literal)) == \
85 0)
84 86
85 bool CanonicalName::IsField() { 87 bool CanonicalName::IsField() {
86 // Fields with private names have the import URI of the library where they are 88 // Fields with private names have the import URI of the library where they are
87 // visible as the parent and the string "@fields" as the parent's parent. 89 // visible as the parent and the string "@fields" as the parent's parent.
88 // Fields with non-private names have the string "@fields' as the parent. 90 // Fields with non-private names have the string "@fields' as the parent.
89 if (IsRoot()) { 91 if (IsRoot()) {
90 return false; 92 return false;
91 } 93 }
92 CanonicalName* kind = this->parent(); 94 CanonicalName* kind = this->parent();
93 if (IsPrivate()) { 95 if (IsPrivate()) {
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 1325
1324 void Program::VisitChildren(Visitor* visitor) { 1326 void Program::VisitChildren(Visitor* visitor) {
1325 VisitList(&libraries(), visitor); 1327 VisitList(&libraries(), visitor);
1326 } 1328 }
1327 1329
1328 1330
1329 } // namespace kernel 1331 } // namespace kernel
1330 1332
1331 } // namespace dart 1333 } // namespace dart
1332 #endif // !defined(DART_PRECOMPILED_RUNTIME) 1334 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW
« 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