Skip to content
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

Fixed RecursionError discovered by OSSFuzz #1201

Merged
merged 1 commit into from
Nov 22, 2023

Conversation

ennamarie19
Copy link
Contributor

This PR introduces a fix to resolve the crashes discovered thus far on ClusterFuzz.

Currently, _split_by_known_words was implemented as a recursive function with two main issues

  1. Infinite recursion was possible when the unknown variable was always equal to the original string
  2. Large inputs cause StackOverflow, as Python has a very limited call-stack before raising a RecursionError

This fix converts the function into an iterative one. All tests that didn't fail before still don't fail.

Thank you for your review!

@ennamarie19 ennamarie19 changed the title Fixed RecursionError discovered by OSSFuzz by converting _split_by_kn… Fixed RecursionError discovered by OSSFuzz Nov 22, 2023
Copy link
Member

@Gallaecio Gallaecio left a comment

Choose a reason for hiding this comment

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

❤️

@Gallaecio Gallaecio merged commit a4032c3 into scrapinghub:master Nov 22, 2023
11 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.

3 participants