-
Notifications
You must be signed in to change notification settings - Fork 30
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
Missing pointer null checks #380
Comments
One thing that's tricky here: ideally we want all our NULL checks to be at the top of the function, so we can avoid doing any work or allocating anything before potentially bailing out. But One way to do this would be to keep the requirement that Another possibility would be to take |
Yet another way to do this would be to make inner functions that return T and then have a helper function that (a) checks the out pointer for NULL, (b) calls the inner function, and (c) assigns the result to the target of the out pointer. |
I like this option. We can produce the reference at the top of the function (with the NULL check and early return), and that will eliminate the late failures. |
@marco-vassena Thanks for the report. We've implemented a fix in #402 that should make this a harder trap to fall into going forward. |
Functions
set_boxed_mut_ptr
andset_arc_mut_ptr
assume that the caller pass non-null pointers. It'd be safer to explicitly check that the pointers are not null and returnrustls_result
.The text was updated successfully, but these errors were encountered: