fix nullptr dereference in prune_requests_older_than#2008
fix nullptr dereference in prune_requests_older_than#2008ivanpauno merged 3 commits intoros2:rollingfrom
Conversation
clalancette
left a comment
There was a problem hiding this comment.
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 <akela1101@gmail.com>
7176087 to
37c6c0b
Compare
|
@clalancette Sorry for waiting. I tried to add 2 tests, please check. The way I tested them locally was: |
Signed-off-by: akela1101 <akela1101@gmail.com>
nice suggestion, fixed |
|
Windows CI is not working yet... @akela1101 can you address DCO failure? |
Co-authored-by: Chen Lihui <lihui.chen@sony.com> Signed-off-by: akela1101 <akela1101@gmail.com>
|
@Mergifyio backport humble |
✅ Backports have been createdDetails
|
* fix nullptr dereference in prune_requests_older_than Signed-off-by: akela1101 <akela1101@gmail.com> * add tests for prune_requests_older_than Signed-off-by: akela1101 <akela1101@gmail.com> * Update rclcpp/test/rclcpp/test_client.cpp Co-authored-by: Chen Lihui <lihui.chen@sony.com> Signed-off-by: akela1101 <akela1101@gmail.com> Signed-off-by: akela1101 <akela1101@gmail.com> Co-authored-by: Chen Lihui <lihui.chen@sony.com> (cherry picked from commit 1ac37b6)
* fix nullptr dereference in prune_requests_older_than Signed-off-by: akela1101 <akela1101@gmail.com> * add tests for prune_requests_older_than Signed-off-by: akela1101 <akela1101@gmail.com> * Update rclcpp/test/rclcpp/test_client.cpp Co-authored-by: Chen Lihui <lihui.chen@sony.com> Signed-off-by: akela1101 <akela1101@gmail.com> Signed-off-by: akela1101 <akela1101@gmail.com> Co-authored-by: Chen Lihui <lihui.chen@sony.com> (cherry picked from commit 1ac37b6) Co-authored-by: andrei <akela1101@gmail.com>
Fixes #2007