[GLUTEN-8534][VL] Fix allowing loops to iterate beyond end of array#8535
Merged
FelixYBW merged 1 commit intoapache:mainfrom Jan 17, 2025
Merged
[GLUTEN-8534][VL] Fix allowing loops to iterate beyond end of array#8535FelixYBW merged 1 commit intoapache:mainfrom
FelixYBW merged 1 commit intoapache:mainfrom
Conversation
FelixYBW
reviewed
Jan 15, 2025
| uint8_t bytesValue2[16]{}; | ||
| for (int k = length - 1; k >= 0; k--) { | ||
| bytesValue2[length - 1 - k] = bytesValue[k]; | ||
| if (length <= 16) { |
Contributor
There was a problem hiding this comment.
Let's add an assert instead.
72dc1f9 to
bada959
Compare
FelixYBW
reviewed
Jan 16, 2025
| uint8_t bytesValue[length]; | ||
| memcpy(bytesValue, memoryAddress + offsets[pos] + wordoffset, length); | ||
| uint8_t bytesValue2[16]{}; | ||
| assert(length <= 16); |
Contributor
There was a problem hiding this comment.
I mean GLUTEN_CHECK.
https://github.com/apache/incubator-gluten/pull/8477/files
144bd4b to
2455558
Compare
2455558 to
a3a0ce0
Compare
FelixYBW
approved these changes
Jan 17, 2025
baibaichen
pushed a commit
to baibaichen/gluten
that referenced
this pull request
Feb 1, 2025
…pache#8535) security volation check
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?
Allowing loops to iterate beyond the end of an array
Since we know bytesValue2 is size 16 the length needs to also be 16 or less so we do not iterate before(beyond) the size of that bytesValue2 array
(Fixes: #8534)