diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-10-26 17:27:51 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-11-05 22:19:09 +0300 |
commit | 237be2ed9e25e4d56deaf3935be0c217913e5a75 (patch) | |
tree | f3389797e763be54b82a159a9cd780ea0f2dbfd3 /src/node_internals.h | |
parent | afd29c9502449121aacba37b253dc39e159aae03 (diff) |
encoding: make TextDecoder handle BOM correctly
Do not accept the BOM if it comes from a different encoding, and
only discard the BOM after it has actually been read (including
when it is spread over multiple chunks in streaming mode).
Fixes: https://github.com/nodejs/node/issues/25315
PR-URL: https://github.com/nodejs/node/pull/30132
Reviewed-By: Gus Caplan <me@gus.host>
Diffstat (limited to 'src/node_internals.h')
-rw-r--r-- | src/node_internals.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/node_internals.h b/src/node_internals.h index 4ec883c8913..2ec230d8b54 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -158,7 +158,11 @@ v8::MaybeLocal<v8::Object> New(Environment* env, char* data, size_t length, bool uses_malloc); - +// Creates a Buffer instance over an existing Uint8Array. +v8::MaybeLocal<v8::Uint8Array> New(Environment* env, + v8::Local<v8::ArrayBuffer> ab, + size_t byte_offset, + size_t length); // Construct a Buffer from a MaybeStackBuffer (and also its subclasses like // Utf8Value and TwoByteValue). // If |buf| is invalidated, an empty MaybeLocal is returned, and nothing is |