Skip to content

Conversation

davisjam
Copy link
Contributor

@davisjam davisjam commented Mar 5, 2018

The regex to decode a number in fpformat is susceptible to
catastrophic backtracking.
This is a potential DOS vector if a server is using fpformat on
untrusted number strings.

Replace it with an equivalent non-vulnerable regex.

The match behavior of the new regex is slightly different.
This difference is addressed with a follow-up check.

https://bugs.python.org/issue32997

The regex to decode a number in fpformat is susceptible to
catastrophic backtracking.
This is a potential DOS vector if a server is using fpformat on
untrusted number strings.

Replace it with an equivalent non-vulnerable regex.

The match behavior of the new regex is slightly different.
This difference is addressed with a follow-up check.
@davisjam
Copy link
Contributor Author

davisjam commented Mar 5, 2018

@serhiy-storchaka Figured you might be a good reviewer?

Use a simplified regex.

Capture the integer part of the number in one group,
then strip off leading 0's.
@davisjam
Copy link
Contributor Author

davisjam commented Mar 5, 2018

@serhiy-storchaka fc083d0 addresses your suggestion in the bpo. I agree that this seems like a better approach.

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.

4 participants