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

Unified Diff: src/string.js

Issue 1725002: Port bugfix in revision 4449 to 2.1 branch. (Closed)
Patch Set: Changed minor version too. Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.cc ('k') | src/version.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/string.js
diff --git a/src/string.js b/src/string.js
index 77c54c20823ae68f507920ec88231ef3b56aadde..e11fbf598840e1d54e780f7bbc0944c5bcbe9205 100644
--- a/src/string.js
+++ b/src/string.js
@@ -912,10 +912,10 @@ ReplaceResultBuilder.prototype.add = function(str) {
ReplaceResultBuilder.prototype.addSpecialSlice = function(start, end) {
var len = end - start;
- if (len == 0) return;
+ if (start < 0 || len <= 0) return;
var elements = this.elements;
if (start < 0x80000 && len < 0x800) {
- elements[elements.length] = (start << 11) + len;
+ elements[elements.length] = (start << 11) | len;
} else {
// 0 < len <= String::kMaxLength and Smi::kMaxValue >= String::kMaxLength,
// so -len is a smi.
« no previous file with comments | « src/runtime.cc ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698