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

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

Issue 11447009: - Do not read past the end of the utf32_array. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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 | Annotate | Revision Log
« 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 9978 matching lines...) Expand 10 before | Expand all | Expand 10 after
9989 return false; 9989 return false;
9990 } 9990 }
9991 } 9991 }
9992 return true; 9992 return true;
9993 } 9993 }
9994 9994
9995 9995
9996 bool String::Equals(const int32_t* utf32_array, intptr_t len) const { 9996 bool String::Equals(const int32_t* utf32_array, intptr_t len) const {
9997 CodePointIterator it(*this); 9997 CodePointIterator it(*this);
9998 intptr_t i = 0; 9998 intptr_t i = 0;
9999 while (it.Next()) { 9999 while (it.Next() && (i < len)) {
erikcorry 2012/12/05 10:54:06 LGTM. Obvious optimization: If len > this.length
Ivan Posva 2012/12/07 17:18:06 Different CL.
10000 if (it.Current() != static_cast<int32_t>(utf32_array[i])) { 10000 if (it.Current() != static_cast<int32_t>(utf32_array[i])) {
10001 return false; 10001 return false;
10002 } 10002 }
10003 ++i; 10003 ++i;
10004 } 10004 }
10005 if (i != len) { 10005 if (i != len) {
10006 return false; 10006 return false;
10007 } 10007 }
10008 return true; 10008 return true;
10009 } 10009 }
(...skipping 2109 matching lines...) Expand 10 before | Expand all | Expand 10 after
12119 } 12119 }
12120 return result.raw(); 12120 return result.raw();
12121 } 12121 }
12122 12122
12123 12123
12124 const char* WeakProperty::ToCString() const { 12124 const char* WeakProperty::ToCString() const {
12125 return "_WeakProperty"; 12125 return "_WeakProperty";
12126 } 12126 }
12127 12127
12128 } // namespace dart 12128 } // namespace dart
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