lib: heap: Change to detect overflow, while roundup to native pointer size.

Change to detect overflow while roundup user supplied
size to native pointer size.

Change-Id: I48293edcedf1bcc77536b4c26c45365d2f718ab6
diff --git a/lib/heap/heap.c b/lib/heap/heap.c
index 2f41f6c..a4094fb 100644
--- a/lib/heap/heap.c
+++ b/lib/heap/heap.c
@@ -255,6 +255,11 @@
 		size = sizeof(struct free_heap_chunk);
 
 	// round up size to a multiple of native pointer size
+	if(size > (size + sizeof(void *)))
+	{
+		dprintf(CRITICAL, "invalid input size\n");
+		return NULL;
+	}
 	size = ROUNDUP(size, sizeof(void *));
 
 	// deal with nonzero alignments