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

capi: Bubble up blaze_syms allocation errors properly #741

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

d-e-s-o
Copy link
Collaborator

@d-e-s-o d-e-s-o commented Jul 12, 2024

convert_symbolizedresults_to_c() is a fallible function, but so far we have not checked its result but just returned it straight away. That can result in a NULL pointer being returned without an error code set. Despite being highly unlikely (Rust code would just panic earlier on allocation failure) as it's only our C layer that handles these situations more gracefully, this is not ideal and counter to our stated contract.
Make sure to check the function's return value and set the last error accordingly.

convert_symbolizedresults_to_c() is a fallible function, but so far we
have not checked its result but just returned it straight away. That can
result in a NULL pointer being returned without an error code set.
Despite being highly unlikely (Rust code would just panic earlier on
allocation failure) as it's only our C layer that handles these
situations more gracefully, this is not ideal and counter to our stated
contract.
Make sure to check the function's return value and set the last error
accordingly.

Signed-off-by: Daniel Müller <[email protected]>
@d-e-s-o d-e-s-o merged commit 14e57e0 into libbpf:main Jul 12, 2024
31 checks passed
@d-e-s-o d-e-s-o deleted the topic/alloc-fail branch July 12, 2024 16:54
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.

1 participant