sys/base64: add ACCESS() attribute#22369
Open
maribu wants to merge 1 commit into
Open
Conversation
d9b43ca to
283a304
Compare
crasbe
reviewed
Jun 10, 2026
- annotate functions using the `ACCESS()` macro with the `access` attribute so that GCC can emit proper `-Wstringop-overflow` warnings - use SPDX license IDs Co-authored-by: crasbe <crasbe@gmail.com>
2285973 to
186d47a
Compare
mguetschow
reviewed
Jun 11, 2026
Comment on lines
+73
to
75
| ACCESS(read_only, 1, 2) | ||
| int base64_encode(const void *data_in, size_t data_in_size, | ||
| void *base64_out, size_t *base64_out_size); |
Contributor
There was a problem hiding this comment.
This
Suggested change
| ACCESS(read_only, 1, 2) | |
| int base64_encode(const void *data_in, size_t data_in_size, | |
| void *base64_out, size_t *base64_out_size); | |
| ACCESS(read_only, 1, 2) | |
| ACCESS(write_only, 3, 4) | |
| int base64_encode(const void *data_in, size_t data_in_size, | |
| void *base64_out, size_t *base64_out_size); |
is not possible because base64_out_size is a pointer, right? A shame.
Member
Author
There was a problem hiding this comment.
Indeed. The attribute is pretty limited in what it can express :/
We could change the API to take a size_t for the buffer size and return an ssize_t for how much was actually written. But I'm not sure if it is worth an API change.
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.
Contribution description
ACCESS()macro with theaccessattribute so that GCC can emit proper-Wstringop-overflowwarningsTesting procedure
The CI will do this
Issues/PRs references
#22368
Declaration of AI-Tools / LLMs usage:
Same as in #22368