mirror of
https://src.fedoraproject.org/rpms/nodejs18.git
synced 2024-11-28 11:06:08 +00:00
50877fbc3a
http://blog.nodejs.org/2014/06/16/node-v0-10-29-stable/ - The invalid UTF8 fix has been reverted since this breaks v8 API, which cannot be done in a stable distribution release. This build of nodejs will behave as if NODE_INVALID_UTF8 was set. For more information on the implications, see: http://blog.nodejs.org/2014/06/16/openssl-and-breaking-utf-8-change/
90 lines
2.8 KiB
Diff
90 lines
2.8 KiB
Diff
From c7c934c66cd8712c9ff169f1ef4c5670d3ff99c8 Mon Sep 17 00:00:00 2001
|
|
From: "T.C. Hollingsworth" <tchollingsworth@gmail.com>
|
|
Date: Wed, 18 Jun 2014 23:09:03 -0700
|
|
Subject: [PATCH] Revert "string_bytes: Guarantee valid utf-8 output"
|
|
|
|
This reverts commit 0da4c671659cfbae12def127b2e94690b9d9b5e1.
|
|
---
|
|
src/node.cc | 7 -------
|
|
src/string_bytes.cc | 2 +-
|
|
src/string_bytes.h | 2 --
|
|
test/simple/test-buffer.js | 12 ------------
|
|
4 files changed, 1 insertion(+), 22 deletions(-)
|
|
|
|
diff --git a/src/node.cc b/src/node.cc
|
|
index 4223973..e9696cd 100644
|
|
--- a/src/node.cc
|
|
+++ b/src/node.cc
|
|
@@ -178,8 +178,6 @@ static uv_async_t dispatch_debug_messages_async;
|
|
// Declared in node_internals.h
|
|
Isolate* node_isolate = NULL;
|
|
|
|
-int WRITE_UTF8_FLAGS = v8::String::HINT_MANY_WRITES_EXPECTED |
|
|
- v8::String::NO_NULL_TERMINATION;
|
|
|
|
static void Spin(uv_idle_t* handle, int status) {
|
|
assert((uv_idle_t*) handle == &tick_spinner);
|
|
@@ -3046,11 +3044,6 @@ static char **copy_argv(int argc, char **argv) {
|
|
}
|
|
|
|
int Start(int argc, char *argv[]) {
|
|
- const char* replaceInvalid = getenv("NODE_INVALID_UTF8");
|
|
-
|
|
- if (replaceInvalid == NULL)
|
|
- WRITE_UTF8_FLAGS |= String::REPLACE_INVALID_UTF8;
|
|
-
|
|
// Hack aroung with the argv pointer. Used for process.title = "blah".
|
|
argv = uv_setup_args(argc, argv);
|
|
|
|
diff --git a/src/string_bytes.cc b/src/string_bytes.cc
|
|
index a7bab38..e4a34fe 100644
|
|
--- a/src/string_bytes.cc
|
|
+++ b/src/string_bytes.cc
|
|
@@ -199,7 +199,7 @@ size_t StringBytes::Write(char* buf,
|
|
break;
|
|
|
|
case UTF8:
|
|
- len = str->WriteUtf8(buf, buflen, chars_written, WRITE_UTF8_FLAGS);
|
|
+ len = str->WriteUtf8(buf, buflen, chars_written, flags);
|
|
break;
|
|
|
|
case UCS2:
|
|
diff --git a/src/string_bytes.h b/src/string_bytes.h
|
|
index 31f04bb..8071a49 100644
|
|
--- a/src/string_bytes.h
|
|
+++ b/src/string_bytes.h
|
|
@@ -29,8 +29,6 @@
|
|
|
|
namespace node {
|
|
|
|
-extern int WRITE_UTF8_FLAGS;
|
|
-
|
|
using v8::Handle;
|
|
using v8::Local;
|
|
using v8::String;
|
|
diff --git a/test/simple/test-buffer.js b/test/simple/test-buffer.js
|
|
index f8b2798..3026824 100644
|
|
--- a/test/simple/test-buffer.js
|
|
+++ b/test/simple/test-buffer.js
|
|
@@ -791,18 +791,6 @@ assert.equal(buf[3], 0xFF);
|
|
assert.equal(buf[3], 0xFF);
|
|
});
|
|
|
|
-// test unmatched surrogates not producing invalid utf8 output
|
|
-// ef bf bd = utf-8 representation of unicode replacement character
|
|
-// see https://codereview.chromium.org/121173009/
|
|
-buf = new Buffer('ab\ud800cd', 'utf8');
|
|
-assert.equal(buf[0], 0x61);
|
|
-assert.equal(buf[1], 0x62);
|
|
-assert.equal(buf[2], 0xef);
|
|
-assert.equal(buf[3], 0xbf);
|
|
-assert.equal(buf[4], 0xbd);
|
|
-assert.equal(buf[5], 0x63);
|
|
-assert.equal(buf[6], 0x64);
|
|
-
|
|
// test for buffer overrun
|
|
buf = new Buffer([0, 0, 0, 0, 0]); // length: 5
|
|
var sub = buf.slice(0, 4); // length: 4
|
|
--
|
|
1.9.3
|
|
|