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

Unified Diff: runtime/lib/string_patch.dart

Issue 1286823003: Fix issue 24043: do not trust the pattern. Enable a 'hidden' test. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: f Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/language/string_interpolation_and_buffer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/string_patch.dart
diff --git a/runtime/lib/string_patch.dart b/runtime/lib/string_patch.dart
index 11db8fe066a8f4e74ede1e9d314ac6427f612edf..21a5ab0090f8329bc2d8d05874492448b5163a12 100644
--- a/runtime/lib/string_patch.dart
+++ b/runtime/lib/string_patch.dart
@@ -896,14 +896,16 @@ class _StringBase {
List<String> result = new List<String>();
int startIndex = 0;
int previousIndex = 0;
+ // 'pattern' may not be implemented correctly and therefore we cannot
+ // call _substringUnhchecked unless it is a trustworthy type (e.g. String).
while (true) {
if (startIndex == length || !iterator.moveNext()) {
- result.add(this._substringUnchecked(previousIndex, length));
+ result.add(this.substring(previousIndex, length));
break;
}
Match match = iterator.current;
if (match.start == length) {
- result.add(this._substringUnchecked(previousIndex, length));
+ result.add(this.substring(previousIndex, length));
break;
}
int endIndex = match.end;
@@ -911,7 +913,7 @@ class _StringBase {
++startIndex; // empty match, advance and restart
continue;
}
- result.add(this._substringUnchecked(previousIndex, match.start));
+ result.add(this.substring(previousIndex, match.start));
startIndex = previousIndex = endIndex;
}
return result;
« no previous file with comments | « no previous file | tests/language/string_interpolation_and_buffer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698