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

Avoid accessing statistics_resource_adaptor stack top if it is empty #1588

Merged
merged 3 commits into from
Jun 27, 2024

Conversation

harrism
Copy link
Member

@harrism harrism commented Jun 25, 2024

Description

Fixes #1587

Note: the only time UB could occur was in the constructor, because the ctor pushes a pair onto the stack and pop_counters() does not allow the last pair to be popped. Therefore, we only need to check for empty in push_counters().

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@harrism harrism added bug Something isn't working 3 - Ready for review Ready for review by team non-breaking Non-breaking change labels Jun 25, 2024
@harrism harrism self-assigned this Jun 25, 2024
@harrism harrism requested a review from a team as a code owner June 25, 2024 02:24
@harrism harrism requested review from rongou, miscco and madsbk June 25, 2024 02:24
@github-actions github-actions bot added the cpp Pertains to C++ code label Jun 25, 2024
Copy link
Member

@madsbk madsbk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch

Copy link
Contributor

@wence- wence- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking suggestion.

include/rmm/mr/device/statistics_resource_adaptor.hpp Outdated Show resolved Hide resolved
@harrism
Copy link
Member Author

harrism commented Jun 27, 2024

/merge

@rapids-bot rapids-bot bot merged commit 0f608ec into rapidsai:branch-24.08 Jun 27, 2024
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Ready for review Ready for review by team bug Something isn't working cpp Pertains to C++ code non-breaking Non-breaking change
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[BUG] statistics_resource_adaptor UB when empty stack is accessed
4 participants