Reviewers: Erik Corry, Description: Fixed bug 114
Please review this at http://codereview.chromium.org/7263 Affected files: M src/runtime.cc A test/mjsunit/regress/regress-114.js Index: src/runtime.cc diff --git a/src/runtime.cc b/src/runtime.cc index f3fb849de4dd81aad03cda7f96053aa8b822b2c5..75285e10a0dd58e9bccf1e0b112cf5c360e18fdd 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -2156,12 +2156,14 @@ static Object* ConvertCase(Arguments args, // "realloc" it and probably, in the vast majority of cases, // extend the existing string to be able to hold the full // result. - int current_length = i + char_length + mapping->get(next, 0, chars); + int next_length = mapping->get(next, 0, chars); + if (next_length == 0) next_length = 1; + int current_length = i + char_length + next_length; while (buffer->has_more()) { current = buffer->GetNext(); int char_length = mapping->get(current, 0, chars); if (char_length == 0) char_length = 1; - current += char_length; + current_length += char_length; } length = current_length; goto try_convert; Index: test/mjsunit/regress/regress-114.js diff --git a/test/mjsunit/regress/regress-114.js b/test/mjsunit/regress/regress-114.js new file mode 100644 index 0000000000000000000000000000000000000000..f14b1c09792a2713f70d02129d89eadfa1baf17b --- /dev/null +++ b/test/mjsunit/regress/regress-114.js @@ -0,0 +1,30 @@ +// Copyright 2008 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +assertEquals("FRIEDRICHSTRASSE 14", "friedrichstra\xDFe 14".toUpperCase()); +assertEquals("---SSSSSS---", "---\xDF\xDF\xDF---".toUpperCase()); +assertEquals("(SS)", "(\xDF)".toUpperCase()); --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
