diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2014-03-15 02:04:02 +0100 |
---|---|---|
committer | Fedor Indutny <fedor.indutny@gmail.com> | 2014-03-16 16:15:34 +0400 |
commit | c30cc4e3a5ead3ca5b48e8eec445740775888ed8 (patch) | |
tree | af71c08d61697753c053098f0bd5c8727c0f419e /src/string_bytes.cc | |
parent | e87ceb2b427a9b51a55af5898c2ef24b4cc08af2 (diff) | |
download | android-node-v8-c30cc4e3a5ead3ca5b48e8eec445740775888ed8.tar.gz android-node-v8-c30cc4e3a5ead3ca5b48e8eec445740775888ed8.tar.bz2 android-node-v8-c30cc4e3a5ead3ca5b48e8eec445740775888ed8.zip |
src: don't call DecodeWrite() on Buffers
Don't call DecodeWrite() with a Buffer as its argument because it in
turn calls StringBytes::Write() and that method expects a Local<String>.
"Why then does that function take a Local<Value>?" I hear you ask.
Good question but I don't have the answer. I added a CHECK for good
measure and what do you know, all of a sudden a large number of crypto
tests started failing.
Calling DecodeWrite(BINARY) on a buffer is nonsensical anyway: if you
want the contents of the buffer, just copy out the data, there is no
need to decode it - and that's exactly what this commit does.
Fixes a great many instances of the following run-time error in debug
builds:
FATAL ERROR: v8::String::Cast() Could not convert to string
Diffstat (limited to 'src/string_bytes.cc')
-rw-r--r-- | src/string_bytes.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/string_bytes.cc b/src/string_bytes.cc index 1546ca252e..7440210969 100644 --- a/src/string_bytes.cc +++ b/src/string_bytes.cc @@ -301,6 +301,7 @@ size_t StringBytes::Write(Isolate* isolate, size_t len = 0; bool is_extern = GetExternalParts(isolate, val, &data, &len); + CHECK(val->IsString() == true); Local<String> str = val.As<String>(); len = len < buflen ? len : buflen; |