Browse Source

buffer: check data is not null

Because it's possible for the data within a Buffer instance to be
altered after instantiation, or in case a user attempts to do something
like the following:

Buffer.prototype.fill.call({}, 10, 0, 10);

It doesn't result in a segfault.
v0.11.8-release
Trevor Norris 12 years ago
parent
commit
fe0bf6b7ac
  1. 4
      src/node_buffer.cc

4
src/node_buffer.cc

@ -43,7 +43,9 @@
Local<Object> obj = argT; \
size_t obj_length = obj->GetIndexedPropertiesExternalArrayDataLength(); \
char* obj_data = static_cast<char*>( \
obj->GetIndexedPropertiesExternalArrayData());
obj->GetIndexedPropertiesExternalArrayData()); \
if (obj_length > 0) \
assert(obj_data != NULL);
#define SLICE_START_END(start_arg, end_arg, end_max) \
size_t start; \

Loading…
Cancel
Save