SIGN IN SIGN UP
astral-sh / ruff UNCLAIMED

An extremely fast Python linter and code formatter, written in Rust.

0 0 41 Rust

Add a recursion limit to the parser (#24810)

## Summary

Partial fix for #22930.

Without this malicious or machine generated code could cause a stack
overflow with something as simple as `'(' * 5000 + '1' + ')' * 5000`.

I decided to do the simplest thing and have a limit that's always
applied with a reasonable default. Since:
* the overhead of this check will be tiny
* it seems inconceivable that anyone will want to have no limit 

## Test Plan

PR includes tests.

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
S
Samuel Colvin committed
c423054dc09e5b644c926b6b527b6accfbe693e9
Parent: 4ff86c7
Committed by GitHub <noreply@github.com> on 5/21/2026, 8:34:53 AM