Skip to content

Avoid invalid gcc 14.3 warning about array bounds in mbedtls_xor #73

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

Open
wants to merge 1 commit into
base: zephyr
Choose a base branch
from

Conversation

keith-packard
Copy link

The combination of the multi-byte loop with the single byte loop confuses GCC 14.3's array bounds checker. When the loop size is constant, check to see if it is a multiple of the multi-byte size and bail early. As this will be evaluated at compile time, there should be no run-time cost.

Copy link
Collaborator

@tomi-font tomi-font left a comment

Choose a reason for hiding this comment

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

Could you rather first make a PR in upstream Mbed TLS and then cherry pick it here?

@keith-packard
Copy link
Author

Could you rather first make a PR in upstream Mbed TLS and then cherry pick it here?

Mbed-TLS/mbedtls#10318

@tomi-font
Copy link
Collaborator

Mbed-TLS/mbedtls#10318

Thanks! If you want to get this merged here before it's merged upstream then please add a reference to the upstream PR (e.g. PR #) in the commit message. Otherwise we can just wait and cherry pick the upstream commit (with -x) once it's merged.

@keith-packard
Copy link
Author

Mbed-TLS/mbedtls#10318

Thanks! If you want to get this merged here before it's merged upstream then please add a reference to the upstream PR (e.g. PR #) in the commit message. Otherwise we can just wait and cherry pick the upstream commit (with -x) once it's merged.

It's blocking SDK version 0.18, so we should probably not wait (the fix is pretty easy to review in isolation).

The combination of the multi-byte loop with the single byte loop
confuses GCC 14.3's array bounds checker. When the loop size is
constant, check to see if it is a multiple of the multi-byte size and
bail early. As this will be evaluated at compile time, there should be
no run-time cost.

This change has been submitted upstream:

Mbed-TLS/mbedtls#10318

Signed-off-by: Keith Packard <[email protected]>
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