-
Notifications
You must be signed in to change notification settings - Fork 955
Fix undefined behaviour in bitops unit test #1786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
zuiderkwast
merged 1 commit into
valkey-io:unstable
from
zuiderkwast:ubsan-bitops-unit-test
Feb 26, 2025
Merged
Fix undefined behaviour in bitops unit test #1786
zuiderkwast
merged 1 commit into
valkey-io:unstable
from
zuiderkwast:ubsan-bitops-unit-test
Feb 26, 2025
Conversation
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
Signed-off-by: Viktor Söderqvist <[email protected]>
rjd15372
approved these changes
Feb 26, 2025
Member
rjd15372
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
ranshid
approved these changes
Feb 26, 2025
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## unstable #1786 +/- ##
============================================
- Coverage 71.17% 71.02% -0.15%
============================================
Files 123 123
Lines 65641 65641
============================================
- Hits 46720 46622 -98
- Misses 18921 19019 +98 |
zuiderkwast
added a commit
that referenced
this pull request
Mar 18, 2025
The unit test was added in #1741. It fails when compiled with UBSAN. Using a local array like `char buf[size]` is undefined behaviour when `size == 0`. This fix just makes it size 1 in this case. The failure I got locally: unit/test_bitops.c:28:13: runtime error: variable length array bound evaluates to non-positive value 0 Signed-off-by: Viktor Söderqvist <[email protected]>
xbasel
pushed a commit
to xbasel/valkey
that referenced
this pull request
Mar 27, 2025
The unit test was added in valkey-io#1741. It fails when compiled with UBSAN. Using a local array like `char buf[size]` is undefined behaviour when `size == 0`. This fix just makes it size 1 in this case. The failure I got locally: unit/test_bitops.c:28:13: runtime error: variable length array bound evaluates to non-positive value 0 Signed-off-by: Viktor Söderqvist <[email protected]>
xbasel
pushed a commit
to xbasel/valkey
that referenced
this pull request
Mar 27, 2025
The unit test was added in valkey-io#1741. It fails when compiled with UBSAN. Using a local array like `char buf[size]` is undefined behaviour when `size == 0`. This fix just makes it size 1 in this case. The failure I got locally: unit/test_bitops.c:28:13: runtime error: variable length array bound evaluates to non-positive value 0 Signed-off-by: Viktor Söderqvist <[email protected]>
murphyjacob4
pushed a commit
to enjoy-binbin/valkey
that referenced
this pull request
Apr 13, 2025
The unit test was added in valkey-io#1741. It fails when compiled with UBSAN. Using a local array like `char buf[size]` is undefined behaviour when `size == 0`. This fix just makes it size 1 in this case. The failure I got locally: unit/test_bitops.c:28:13: runtime error: variable length array bound evaluates to non-positive value 0 Signed-off-by: Viktor Söderqvist <[email protected]>
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.
The unit test was added in #1741. It fails when compiled with UBSAN. Using a local array like
char buf[size]is undefined behaviour whensize == 0. This fix just makes it size 1 in this case.The failure I get locally: