This is an automated email from the ASF dual-hosted git repository.
felixybw pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git
The following commit(s) were added to refs/heads/main by this push:
new bc25ac1ea3 [GLUTEN-8538][VL] Fix incorrect calculation of buffer size
(#8542)
bc25ac1ea3 is described below
commit bc25ac1ea35b36dd0c0b27ef82fd220828c1bcf3
Author: jkhaliqi <[email protected]>
AuthorDate: Fri Jan 17 14:31:30 2025 -0800
[GLUTEN-8538][VL] Fix incorrect calculation of buffer size (#8542)
security volation check fix
---
cpp/core/memory/MemoryAllocator.cc | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/cpp/core/memory/MemoryAllocator.cc
b/cpp/core/memory/MemoryAllocator.cc
index c6180f53b3..0fd6489d02 100644
--- a/cpp/core/memory/MemoryAllocator.cc
+++ b/cpp/core/memory/MemoryAllocator.cc
@@ -121,6 +121,7 @@ void ListenableMemoryAllocator::updateUsage(int64_t size) {
}
bool StdMemoryAllocator::allocate(int64_t size, void** out) {
+ GLUTEN_CHECK(size >= 0, "size is less than 0");
*out = std::malloc(size);
if (*out == nullptr) {
return false;
@@ -130,6 +131,8 @@ bool StdMemoryAllocator::allocate(int64_t size, void** out)
{
}
bool StdMemoryAllocator::allocateZeroFilled(int64_t nmemb, int64_t size,
void** out) {
+ GLUTEN_CHECK(nmemb >= 0, "nmemb is less than 0");
+ GLUTEN_CHECK(size >= 0, "size is less than 0");
*out = std::calloc(nmemb, size);
if (*out == nullptr) {
return false;
@@ -139,6 +142,7 @@ bool StdMemoryAllocator::allocateZeroFilled(int64_t nmemb,
int64_t size, void**
}
bool StdMemoryAllocator::allocateAligned(uint64_t alignment, int64_t size,
void** out) {
+ GLUTEN_CHECK(size >= 0, "size is less than 0");
*out = aligned_alloc(alignment, size);
if (*out == nullptr) {
return false;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]