nodejs/nodejs-revert-utf8-v8.patch
T.C. Hollingsworth ee85520942 new upstream release 0.10.33
http://blog.nodejs.org/2014/10/23/node-v0-10-33-stable/
- This release disables SSLv3 to secure Node.js services against the POODLE
  attack.  (CVE-2014-3566; RHBZ#1152789)  For more information or to learn how
  to re-enable SSLv3 in order to support legacy clients, please see the upstream
  release announcement linked above.
2014-11-18 18:22:09 -07:00

91 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
@@ -180,9 +180,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);
assert(status == 0);
@@ -3077,11 +3074,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