smalloc: fix bad assert for zero length data
If the data length passed to smalloc.alloc() the array_length will be zero, causing an overflow check to fail. This prevents that from happening. Signed-off-by: Trevor Norris <trev.norris@gmail.com>
This commit is contained in:
parent
b636ba8186
commit
372a2f56be
@ -132,7 +132,7 @@ void CallbackInfo::WeakCallback(Isolate* isolate, Local<Object> object) {
|
||||
object->GetIndexedPropertiesExternalArrayDataType();
|
||||
size_t array_size = ExternalArraySize(array_type);
|
||||
CHECK_GT(array_size, 0);
|
||||
if (array_size > 1) {
|
||||
if (array_size > 1 && array_data != NULL) {
|
||||
CHECK_GT(array_length * array_size, array_length); // Overflow check.
|
||||
array_length *= array_size;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user