Skip to content

fix: Fix stack overflow in parse_subexpr #1410

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 1 commit into from
Sep 6, 2024

Conversation

eejbyfeldt
Copy link
Contributor

@eejbyfeldt eejbyfeldt commented Sep 5, 2024

This patch moves the guard from parse_expr to parse_subexpr. This helps
prevent us from overflowing the stack in more cases. Also added a test case for where the current code has a stackoverflow. The test cases is a expression contains a repeated +(unary plus) leading to a stackoverflow.

Found by running the fuzzer.

This patch moves the guard from parse_expr to parse_subexpr. This helps
prevent us from overflowing the stack. Also added a test case for one
such example where and expression contains a repeated +(unary plus)
leading to a stackoverflow.
@coveralls
Copy link

Pull Request Test Coverage Report for Build 10715369940

Details

  • 6 of 6 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.002%) to 89.253%

Totals Coverage Status
Change from base Build 10653671802: 0.002%
Covered Lines: 28742
Relevant Lines: 32203

💛 - Coveralls

@eejbyfeldt eejbyfeldt marked this pull request as ready for review September 5, 2024 07:04
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thank you @eejbyfeldt

@alamb
Copy link
Contributor

alamb commented Sep 6, 2024

FYI @iffyio

@alamb alamb merged commit 4875dad into apache:main Sep 6, 2024
10 checks passed
ayman-sigma pushed a commit to sigmacomputing/sqlparser-rs that referenced this pull request Nov 19, 2024
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