v8/test
Marja Hölttä 6389b7e6b6 [unicode] Return (the correct) errors for overlong / surrogate sequences.
This fix is two-fold:

1) Incremental UTF-8 decoding: Unify incorrect UTF-8 handling between V8 and
Blink.

Incremental UTF-8 decoding used to allow some overlong sequences / invalid code
points which Blink treated as errors. This caused the decoder and the Blink
UTF-8 decoder to produce a different number of bytes, resulting in random
failures when scripts were streamed (especially, this was detected by the
skipping inner functions feature which adds CHECKs against expected function
positions).

2) Non-incremental UTF-8 decoding: return the correct amount of invalid characters.

According to the encoding spec ( https://encoding.spec.whatwg.org/#utf-8-decoder
), the first byte of an overlong sequence / invalid code point generates an
invalid character, and the rest of the bytes are not processed (i.e., pushed
back to the byte stream). When they're handled, they will look like lonely
continuation bytes, and will generate an invalid character each.

As a result, an overlong 4-byte sequence should generate 4 invalid characters
(not 1).

This is a potentially breaking change, since the (non-incremental) UTF-8
decoding is exposed via the API (String::NewFromUtf8). The behavioral difference
happens when the client is passing in invalid UTF-8 (containing overlong /
surrogate sequences).

However, afaict, this doesn't change the semantics of any JavaScript program:
according to the ECMAScript spec, the program is a sequence of Unicode code
points, and there's no way to invoke the UTF-8 decoding functionalities from
inside JavaScript. Though, this changes the behavior of d8 when decoding source
files which are invalid UTF-8.

This doesn't change anything related to URI decoding (it already throws
exceptions for overlong sequences / invalid code points).

BUG: chromium:765608, chromium:758236, v8:5516
Bug: 
Change-Id: Ib029f6a8e87186794b092e4e8af32d01cee3ada0
Reviewed-on: https://chromium-review.googlesource.com/671020
Commit-Queue: Marja Hölttä <marja@chromium.org>
Reviewed-by: Franziska Hinkelmann <franzih@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48105}
2017-09-21 10:44:40 +00:00
..
benchmarks Use --opt instead of --crankshaft in tests. 2017-04-28 14:20:39 +00:00
cctest [unicode] Return (the correct) errors for overlong / surrogate sequences. 2017-09-21 10:44:40 +00:00
common Revert "Add capability of throwing values in WASM" 2017-09-15 20:27:39 +00:00
debugger [bigint] Add bytecodes for unary-minus and bitwise-not 2017-09-12 19:07:59 +00:00
fuzzer [iwyu] Remove obsolete "api.h" include from "handles-inl.h". 2017-09-11 12:52:20 +00:00
inspector [inspector] report [[Scopes]] all the time 2017-09-12 21:17:35 +00:00
intl Fix common misspellings 2017-08-02 09:35:28 +00:00
js-perf-test Implement microbenchmark for has-in idiom 2017-09-13 08:48:44 +00:00
memory [snapshot] add tracking for builtin snapshot size. 2017-08-31 07:29:31 +00:00
message [builtins] Port String.prototype.repeat to CSA 2017-09-15 06:51:56 +00:00
mjsunit [wasm] Fix memory initialization on instantiate 2017-09-20 22:52:31 +00:00
mkgrokdump Fix compilation failure due to overload of virtual function 2017-05-24 21:19:48 +00:00
mozilla Reland "[d8] implement setTimeout." 2017-09-05 07:30:46 +00:00
preparser
promises-aplus Fix common misspellings 2017-08-02 09:35:28 +00:00
test262 [intl] fix off-by-1 in NumberFormat formatToParts parameter parsing 2017-09-18 20:07:23 +00:00
unittests [heap] Remove marking deque overflow handling 2017-09-19 05:20:20 +00:00
wasm-spec-tests [wasm] Update the wasm spec tests 2017-09-05 09:44:48 +00:00
webkit [parser] Inline ParseStatemantAsUnlabelled into its only useful caller 2017-09-07 21:01:46 +00:00
bot_default.gyp [wasm] Add wasm spec tests to the v8 test runner 2017-04-27 13:00:13 +00:00
bot_default.isolate [wasm] Add wasm spec tests to the v8 test runner 2017-04-27 13:00:13 +00:00
BUILD.gn [wasm] Remove the wasm-asmjs fuzzer 2017-06-21 10:59:35 +00:00
default.gyp [wasm] Add wasm spec tests to the v8 test runner 2017-04-27 13:00:13 +00:00
default.isolate [wasm] Add wasm spec tests to the v8 test runner 2017-04-27 13:00:13 +00:00
optimize_for_size.gyp
optimize_for_size.isolate [debugger] basic test infrastructure for new debugger test api. 2016-10-21 06:38:05 +00:00
perf.gyp
perf.isolate Remove SIMD.js from V8. 2017-02-14 06:57:25 +00:00