Skip to content

fix a bug where destroying a creds provider during a operation can lead to a use after free - #3884

Merged
sbiscigl merged 1 commit into
mainfrom
crt-creds-use-after-free
Jul 31, 2026
Merged

fix a bug where destroying a creds provider during a operation can lead to a use after free#3884
sbiscigl merged 1 commit into
mainfrom
crt-creds-use-after-free

Conversation

@sbiscigl

Copy link
Copy Markdown
Collaborator

Description of changes:

If a crt credentials provider is destroyed during its operation, the async callback may return after the stack variable has fell off. this moves the lock to a heap variable thats lifetime is managed by a shared pointer to avoid lifetime issues.

Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@sbiscigl
sbiscigl marked this pull request as ready for review July 30, 2026 20:48
@sbiscigl
sbiscigl force-pushed the crt-creds-use-after-free branch from f839fb1 to 864e97c Compare July 30, 2026 20:54
Comment thread tests/aws-cpp-sdk-core-tests/aws/auth/CrtCredentialsProviderTest.cpp Outdated
@sbiscigl
sbiscigl force-pushed the crt-creds-use-after-free branch from 864e97c to 0a7a8b1 Compare July 30, 2026 21:30
@sbiscigl
sbiscigl force-pushed the crt-creds-use-after-free branch from 0a7a8b1 to d5b12a9 Compare July 31, 2026 14:06
@sbiscigl
sbiscigl added this pull request to the merge queue Jul 31, 2026
Merged via the queue into main with commit 93180f1 Jul 31, 2026
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants