[GLUTEN-8538][VL] Fix incorrect calculation of buffer size#8542
Merged
FelixYBW merged 1 commit intoapache:mainfrom Jan 17, 2025
Merged
[GLUTEN-8538][VL] Fix incorrect calculation of buffer size#8542FelixYBW merged 1 commit intoapache:mainfrom
FelixYBW merged 1 commit intoapache:mainfrom
Conversation
360af1c to
d5d3f55
Compare
FelixYBW
reviewed
Jan 15, 2025
| bool StdMemoryAllocator::allocate(int64_t size, void** out) { | ||
| if (size < 0) { | ||
| return false; | ||
| } |
FelixYBW
reviewed
Jan 15, 2025
| size_t totalSize = nmemb * size; | ||
| if (totalSize / size != nmemb || nmemb < 0 || size < 0) { | ||
| return false; | ||
| } |
Contributor
There was a problem hiding this comment.
isn't nmemb<0 || size <0 enough?
use assert instead
Contributor
Author
There was a problem hiding this 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!
6ad6908 to
b72a002
Compare
FelixYBW
reviewed
Jan 16, 2025
| } | ||
|
|
||
| bool StdMemoryAllocator::allocate(int64_t size, void** out) { | ||
| assert(size < 0); |
FelixYBW
reviewed
Jan 16, 2025
| } | ||
|
|
||
| bool StdMemoryAllocator::allocateZeroFilled(int64_t nmemb, int64_t size, void** out) { | ||
| assert(nmemb < 0 && size < 0); |
FelixYBW
reviewed
Jan 16, 2025
| } | ||
|
|
||
| bool StdMemoryAllocator::allocateAligned(uint64_t alignment, int64_t size, void** out) { | ||
| assert(size < 0); |
bcc1d66 to
498ae2d
Compare
498ae2d to
e51bcee
Compare
FelixYBW
approved these changes
Jan 17, 2025
Contributor
|
===== Performance report for TPCDS SF2000 with Velox backend, for reference only ====
|
Contributor
|
===== Performance report for TPCH SF2000 with Velox backend, for reference only ====
|
Contributor
|
===== Performance report for TPCDS SF2000 with Velox backend, for reference only ====
|
Contributor
|
===== Performance report for TPCH SF2000 with Velox backend, for reference only ====
|
baibaichen
pushed a commit
to baibaichen/gluten
that referenced
this pull request
Feb 1, 2025
security volation check fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Fix incorrect calculation of buffer size
False positives:
cpp/velox/udf/UdfLoader.cc:79
cpp/velox/udf/UdfLoader.cc:106
(Fixes: #8538)