v8: work around String::WriteAscii segfault
See http://code.google.com/p/v8/issues/detail?id=2493 for details. Once the patch lands in upstream V8, this commit can be reverted.
This commit is contained in:
parent
b4b750b6a5
commit
9668df8b39
2
deps/v8/src/v8utils.h
vendored
2
deps/v8/src/v8utils.h
vendored
@ -209,6 +209,8 @@ INLINE(void CopyChars(sinkchar* dest, const sourcechar* src, int chars));
|
||||
|
||||
template <typename sourcechar, typename sinkchar>
|
||||
void CopyChars(sinkchar* dest, const sourcechar* src, int chars) {
|
||||
ASSERT(chars >= 0);
|
||||
if (chars == 0) return;
|
||||
sinkchar* limit = dest + chars;
|
||||
#ifdef V8_HOST_CAN_READ_UNALIGNED
|
||||
if (sizeof(*dest) == sizeof(*src)) {
|
||||
|
@ -22,8 +22,15 @@
|
||||
var common = require('../common');
|
||||
var assert = require('assert');
|
||||
|
||||
var SlowBuffer = require('buffer').SlowBuffer;
|
||||
var Buffer = require('buffer').Buffer;
|
||||
|
||||
// Regression test for segfault introduced in commit e501ce4.
|
||||
['base64','binary','ucs2','utf8','ascii'].forEach(function(encoding) {
|
||||
var buf = new SlowBuffer(0);
|
||||
buf.write('', encoding);
|
||||
});
|
||||
|
||||
var b = Buffer(1024); // safe constructor
|
||||
|
||||
console.log('b.length == ' + b.length);
|
||||
|
Loading…
x
Reference in New Issue
Block a user