v8/test/mjsunit/regress/regress-4654.js
littledan f3e41d96dd Fix Unicode string normalization with null bytes
Previously, String.prototype.normalize constructed its ICU input
string as a null-terminated string. This creates a bug for strings
which contain a null byte, which is allowed in ECMAScript. This
patch constructs the ICU string based on its length so that the
entire string is normalized.

R=jshin@chromium.org
BUG=v8:4654
LOG=Y

Review URL: https://codereview.chromium.org/1645223003

Cr-Commit-Position: refs/heads/master@{#33614}
2016-01-29 17:00:46 +00:00

6 lines
241 B
JavaScript

// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
assertEquals('hello\u0000foobar', 'hello\u0000foobar'.normalize('NFC'));