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

Unified Diff: src/runtime.cc

Issue 2577001: Fix double to integer conversions in runtime string indexing. (Closed)
Patch Set: Created 10 years, 7 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 | test/mjsunit/string-charat.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 80e67cc87585ce206e5ff200e0ea3a53c1240534..50a29c24f9770d31d8258cda9cf782bf722daada 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -1665,7 +1665,7 @@ static Object* Runtime_StringCharCodeAt(Arguments args) {
} else {
ASSERT(index->IsHeapNumber());
double value = HeapNumber::cast(index)->value();
- i = static_cast<uint32_t>(value);
+ i = static_cast<uint32_t>(DoubleToInteger(value));
}
// Flatten the string. If someone wants to get a char at an index
« no previous file with comments | « no previous file | test/mjsunit/string-charat.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698