Skip to content
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

Fix undefined behaviour in volk_32u_reverse_32u #664

Merged
merged 1 commit into from
Oct 22, 2023

Conversation

argilo
Copy link
Member

@argilo argilo commented Oct 19, 2023

Undefined Behaviour Sanitizer (UBSAN, -fsanitize=undefined) reports two instances of overflowing left shifts in volk_32u_reverse_32u.

In both cases, an unsigned char is promoted to int and then left-shifted by 24 bits, but int is not large enough to hold the result. I've added an explicit cast to uint32_t, which resolves the Undefined Behaviour warnings.

Copy link
Contributor

@jdemel jdemel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jdemel jdemel merged commit fda1a8b into gnuradio:main Oct 22, 2023
31 of 32 checks passed
@argilo argilo mentioned this pull request Oct 23, 2023
@argilo argilo deleted the fix-reverse-ub branch December 2, 2023 16:48
Alesha72003 pushed a commit to Alesha72003/volk that referenced this pull request May 15, 2024
Fix undefined behaviour in volk_32u_reverse_32u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants