-
Notifications
You must be signed in to change notification settings - Fork 422
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 nullptr dereference in prune_requests_older_than #2008
Conversation
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.
This function is buggy as you point out, so thanks for the fix.
That said, the reason we didn't know it was wrong was that we don't have a test for this function. Could you add two tests, one of which has pruned_requests
as nullptr (or just not passed), and one of which has pruned_requests
as a pointer?
(also, completely orthogonally, why is pruned_requests
a pointer and not a reference? Maybe @ivanpauno can chime in since he added this API)
It's an optional output argument, so the vector isn't used if |
Signed-off-by: akela1101 <[email protected]>
7176087
to
37c6c0b
Compare
@clalancette Sorry for waiting. I tried to add 2 tests, please check. The way I tested them locally was:
|
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.
lgtm!
Signed-off-by: akela1101 <[email protected]>
nice suggestion, fixed |
Windows CI is not working yet... @akela1101 can you address DCO failure? |
Co-authored-by: Chen Lihui <[email protected]> Signed-off-by: akela1101 <[email protected]>
@Mergifyio backport humble |
✅ Backports have been created
|
* fix nullptr dereference in prune_requests_older_than Signed-off-by: akela1101 <[email protected]> * add tests for prune_requests_older_than Signed-off-by: akela1101 <[email protected]> * Update rclcpp/test/rclcpp/test_client.cpp Co-authored-by: Chen Lihui <[email protected]> Signed-off-by: akela1101 <[email protected]> Signed-off-by: akela1101 <[email protected]> Co-authored-by: Chen Lihui <[email protected]> (cherry picked from commit 1ac37b6)
* fix nullptr dereference in prune_requests_older_than Signed-off-by: akela1101 <[email protected]> * add tests for prune_requests_older_than Signed-off-by: akela1101 <[email protected]> * Update rclcpp/test/rclcpp/test_client.cpp Co-authored-by: Chen Lihui <[email protected]> Signed-off-by: akela1101 <[email protected]> Signed-off-by: akela1101 <[email protected]> Co-authored-by: Chen Lihui <[email protected]> (cherry picked from commit 1ac37b6) Co-authored-by: andrei <[email protected]>
Fixes #2007