-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Fix donut backtracking #37788
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
Fix donut backtracking #37788
Conversation
|
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. |
|
cc @Michellehbn! I think this is simple enough and we should be able to merge it without too much trouble |
gante
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
| potential_end = re.search(r">", tokens[potential_start.end() :], re.IGNORECASE) | ||
| if potential_end is None: | ||
| break | ||
| start_token = tokens[potential_start.start() : potential_start.end() + potential_end.end()] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I would add a comment (or create intermediary vars) to help explain the why behind potential_start.end() + potential_end.end() (potential_end searches over a substring)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good point! I rewrote that bit.
43896b7 to
5a8abeb
Compare
* Fix donut backtracking * make fixup * Trigger tests * Remove old line * Update code * Fix reversed slice
There's an exploitable regex in the donut processor, this replaces it with less blowup-prone code!