-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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 minor time-of-check vs time-of-use pointer issues #40128
Conversation
Aw, the asan-test failed because of a timeout :( Can it be re-run without me doing a new push?
|
@kokke would you like to update the PR? |
Hi @targos - sorry for keeping you guys waiting! I assumed whomever approved the PR, would incorporate the changes proposed by @addaleax I have pushed those to my fork now, so I think the PR is ready to be merged (once tests complete). Please let me know if I have misunderstood or need to do anything else to satisfy the process. |
@targos I've updated the PR - thanks for your patience with me :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Landed in afb4ad6...4f3eda6 |
Refs: #40128 PR-URL: #40128 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
Refs: #40128 PR-URL: #40128 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
Refs: #40128 PR-URL: #40128 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
Refs: #40128 PR-URL: #40128 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
This PR addresses two minor issues (nits):
1 : A time-of-use/time-of-check 'bug' in src/crypto/crypto_context.cc
The pointer 'env' is checked against NULL on line 1117, but it gets dereferenced at line 1101+1102.
Note comments for line 1101, 1102 and 1117.
Suggestion: Skip the null-check on line 1117. If 'env' could be NULL, the code would have segfaulted before reaching line 1117 anyway.
and 2 : A time-of-check vs time-of-use bug in src/udp_wrap.cc:370
The pointer 'wrap' is checked against NULL on line 376, but it gets dereferenced at line 370.
Note comments for line 370 and 376.
Suggested solutions:
So the code becomes either:
... or
For context: These two issues were found using a homemade static analysis tool that flags instances where pointers are checked against NULL after they have already been dereferenced.