mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
makeFastBuffer should not segfault but rather throw on non-buffer
This commit is contained in:
1 parent
f4e69e44ff
commit
5e409c2f1a
2 files changed
+9
No files matched your search
@@ -679,6 +679,11 @@ Handle<Value> Buffer::ByteLength(const Arguments &args) {
|
||||
Handle<Value> Buffer::MakeFastBuffer(const Arguments &args) {
|
||||
HandleScope scope;
|
||||
|
||||
if (!Buffer::HasInstance(args[0])) {
|
||||
return ThrowException(Exception::TypeError(String::New(
|
||||
"First argument must be a Buffer")));
|
||||
}
|
||||
|
||||
Buffer *buffer = ObjectWrap::Unwrap<Buffer>(args[0]->ToObject());
|
||||
Local<Object> fast_buffer = args[1]->ToObject();;
|
||||
uint32_t offset = args[2]->Uint32Value();
|
||||
|
||||
Reference in new issue
Block a user