Skip to content

Fix use-after-free race in TransliteratorAlias compoundFilter#3913

Open
hirorogo wants to merge 1 commit intounicode-org:mainfrom
hirorogo:fix-transreg-compoundfilter-race
Open

Fix use-after-free race in TransliteratorAlias compoundFilter#3913
hirorogo wants to merge 1 commit intounicode-org:mainfrom
hirorogo:fix-transreg-compoundfilter-race

Conversation

@hirorogo
Copy link
Copy Markdown

Summary

TransliteratorAlias stored a raw non-owning pointer to the TransliteratorEntry's compoundFilter. When the registry mutex is released between registry->get() and alias->create(), a concurrent Transliterator::unregister() call can delete the entry (and its compoundFilter) while the alias still holds a dangling pointer, causing a use-after-free.

The source comment at transreg.cpp lines 30-36 notes that BoundsChecker has reported dangling pointer errors with these entry objects, corroborating this race condition.

Changes

  • Clone compoundFilter in both TransliteratorAlias constructors instead of storing a raw alias pointer
  • Delete owned compoundFilter in ~TransliteratorAlias()
  • Update header comment and type from const UnicodeSet* (alias) to UnicodeSet* (owned)

Test plan

  • Existing ICU transliterator tests pass
  • Concurrent createInstance + unregister on the same ID no longer triggers UAF

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 19, 2026

CLA assistant check
All committers have signed the CLA.

@markusicu
Copy link
Copy Markdown
Member

@hirorogo Could you please sign the CLA -- otherwise we can't look at your changes -- and create a Jira ticket with the problem description?

hirorogo added a commit to hirorogo/icu that referenced this pull request Mar 27, 2026
@hirorogo hirorogo force-pushed the fix-transreg-compoundfilter-race branch from b2507fc to b8391c6 Compare March 27, 2026 14:20
@jira-pull-request-webhook
Copy link
Copy Markdown

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

@hirorogo hirorogo force-pushed the fix-transreg-compoundfilter-race branch from b8391c6 to 9a89dab Compare March 27, 2026 14:21
@jira-pull-request-webhook
Copy link
Copy Markdown

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

@hirorogo hirorogo force-pushed the fix-transreg-compoundfilter-race branch from 9a89dab to 856bf9c Compare March 27, 2026 14:22
@jira-pull-request-webhook
Copy link
Copy Markdown

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants