From 372a2f56bed341a23c435c5a94fbb77dbbd6c600 Mon Sep 17 00:00:00 2001 From: Trevor Norris Date: Mon, 5 Jan 2015 02:20:31 -0800 Subject: [PATCH] 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 --- src/smalloc.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/smalloc.cc b/src/smalloc.cc index 7dc3510a0bf5..0cd8f3eb9e46 100644 --- a/src/smalloc.cc +++ b/src/smalloc.cc @@ -132,7 +132,7 @@ void CallbackInfo::WeakCallback(Isolate* isolate, Local 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; }