From: fschneider@chromium.org Date: Fri, 15 Jan 2010 12:00:21 +0000 (+0000) Subject: Fix bug in keyed load stub for strings. X-Git-Tag: upstream/4.7.83~22691 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d234b0e2ad8768f21c0ca7c30284eb2d12847317;p=platform%2Fupstream%2Fv8.git Fix bug in keyed load stub for strings. Instead of returning the empty string when indexing a string out of bounds we now correctly return undefined. Review URL: http://codereview.chromium.org/542089 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3611 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/runtime.cc b/src/runtime.cc index 3a6e176..617dfaa 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -1479,7 +1479,11 @@ static Object* Runtime_StringCharAt(Arguments args) { CONVERT_CHECKED(String, subject, args[0]); Object* index = args[1]; - return CharFromCode(CharCodeAt(subject, index)); + Object* code = CharCodeAt(subject, index); + if (code == Heap::nan_value()) { + return Heap::undefined_value(); + } + return CharFromCode(code); }