jkhaliqi commented on code in PR #8542:
URL: https://github.com/apache/incubator-gluten/pull/8542#discussion_r1917363403


##########
cpp/core/memory/MemoryAllocator.cc:
##########
@@ -130,6 +133,10 @@ bool StdMemoryAllocator::allocate(int64_t size, void** 
out) {
 }
 
 bool StdMemoryAllocator::allocateZeroFilled(int64_t nmemb, int64_t size, 
void** out) {
+  size_t totalSize = nmemb * size;
+  if (totalSize / size != nmemb || nmemb < 0 || size < 0) {
+    return false;
+  }

Review Comment:
   Right I was thinking we had to check to make sure there was no overflow but 
if calloc fails then it will give nullptr anyways and return false so the 
sizing check being bigger than 0 should be enough!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to