Skip to content

Fix ReDOS in tokenizer digit substitution #38844

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

Merged
merged 3 commits into from
Jun 19, 2025
Merged

Fix ReDOS in tokenizer digit substitution #38844

merged 3 commits into from
Jun 19, 2025

Conversation

Rocketknight1
Copy link
Member

@Rocketknight1 Rocketknight1 commented Jun 16, 2025

We use possessive quantifiers with regex for Py < 3.11 or re for Py >= 3.11 to avoid huge slowdown here.

cc @Michellehbn !

@Rocketknight1 Rocketknight1 marked this pull request as ready for review June 16, 2025 12:43
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Member

@gante gante left a comment

Choose a reason for hiding this comment

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

LGTM, let's make sure this is tested :D

@Rocketknight1
Copy link
Member Author

@gante this is tested in test_tokenization_clvp.py after all! I checked the slow tests and they're all still passing, so I think we're good to go.

@Rocketknight1 Rocketknight1 merged commit 54a0216 into main Jun 19, 2025
18 checks passed
@Rocketknight1 Rocketknight1 deleted the fix-digit-redos branch June 19, 2025 13:53
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.

3 participants