]> git.pld-linux.org Git - packages/nodejs.git/blob - nodejs-revert-utf8-v8.patch
up to 0.10.30; The invalid UTF8 fix has been reverted
[packages/nodejs.git] / nodejs-revert-utf8-v8.patch
1 From c7c934c66cd8712c9ff169f1ef4c5670d3ff99c8 Mon Sep 17 00:00:00 2001
2 From: "T.C. Hollingsworth" <tchollingsworth@gmail.com>
3 Date: Wed, 18 Jun 2014 23:09:03 -0700
4 Subject: [PATCH] Revert "string_bytes: Guarantee valid utf-8 output"
5
6 This reverts commit 0da4c671659cfbae12def127b2e94690b9d9b5e1.
7 ---
8  src/node.cc                |  7 -------
9  src/string_bytes.cc        |  2 +-
10  src/string_bytes.h         |  2 --
11  test/simple/test-buffer.js | 12 ------------
12  4 files changed, 1 insertion(+), 22 deletions(-)
13
14 diff --git a/src/node.cc b/src/node.cc
15 index 4223973..e9696cd 100644
16 --- a/src/node.cc
17 +++ b/src/node.cc
18 @@ -178,8 +178,6 @@ static uv_async_t dispatch_debug_messages_async;
19  // Declared in node_internals.h
20  Isolate* node_isolate = NULL;
21  
22 -int WRITE_UTF8_FLAGS = v8::String::HINT_MANY_WRITES_EXPECTED |
23 -                       v8::String::NO_NULL_TERMINATION;
24  
25  static void Spin(uv_idle_t* handle, int status) {
26    assert((uv_idle_t*) handle == &tick_spinner);
27 @@ -3046,11 +3044,6 @@ static char **copy_argv(int argc, char **argv) {
28  }
29  
30  int Start(int argc, char *argv[]) {
31 -  const char* replaceInvalid = getenv("NODE_INVALID_UTF8");
32 -
33 -  if (replaceInvalid == NULL)
34 -    WRITE_UTF8_FLAGS |= String::REPLACE_INVALID_UTF8;
35 -
36    // Hack aroung with the argv pointer. Used for process.title = "blah".
37    argv = uv_setup_args(argc, argv);
38  
39 diff --git a/src/string_bytes.cc b/src/string_bytes.cc
40 index a7bab38..e4a34fe 100644
41 --- a/src/string_bytes.cc
42 +++ b/src/string_bytes.cc
43 @@ -199,7 +199,7 @@ size_t StringBytes::Write(char* buf,
44        break;
45  
46      case UTF8:
47 -      len = str->WriteUtf8(buf, buflen, chars_written, WRITE_UTF8_FLAGS);
48 +      len = str->WriteUtf8(buf, buflen, chars_written, flags);
49        break;
50  
51      case UCS2:
52 diff --git a/src/string_bytes.h b/src/string_bytes.h
53 index 31f04bb..8071a49 100644
54 --- a/src/string_bytes.h
55 +++ b/src/string_bytes.h
56 @@ -29,8 +29,6 @@
57  
58  namespace node {
59  
60 -extern int WRITE_UTF8_FLAGS;
61 -
62  using v8::Handle;
63  using v8::Local;
64  using v8::String;
65 diff --git a/test/simple/test-buffer.js b/test/simple/test-buffer.js
66 index f8b2798..3026824 100644
67 --- a/test/simple/test-buffer.js
68 +++ b/test/simple/test-buffer.js
69 @@ -791,18 +791,6 @@ assert.equal(buf[3], 0xFF);
70    assert.equal(buf[3], 0xFF);
71  });
72  
73 -// test unmatched surrogates not producing invalid utf8 output
74 -// ef bf bd = utf-8 representation of unicode replacement character
75 -// see https://codereview.chromium.org/121173009/
76 -buf = new Buffer('ab\ud800cd', 'utf8');
77 -assert.equal(buf[0], 0x61);
78 -assert.equal(buf[1], 0x62);
79 -assert.equal(buf[2], 0xef);
80 -assert.equal(buf[3], 0xbf);
81 -assert.equal(buf[4], 0xbd);
82 -assert.equal(buf[5], 0x63);
83 -assert.equal(buf[6], 0x64);
84 -
85  // test for buffer overrun
86  buf = new Buffer([0, 0, 0, 0, 0]); // length: 5
87  var sub = buf.slice(0, 4);         // length: 4
88 -- 
89 1.9.3
90
This page took 0.07569 seconds and 3 git commands to generate.