nix-community / rnix-parser

A Nix parser written in Rust [maintainer=@oberblastmeister]
MIT License
365 stars 44 forks source link

avoid stack overflow #119

Closed aaronjanse closed 2 years ago

aaronjanse commented 2 years ago

Summary & Motivation

The fuzzer often finds samples that cause stack overflows, such as a long series of left parenthesis. Fixing this both avoids an error for users and allows the fuzzer to find more interesting bugs in PRs I'm working on.

Backwards-incompatible changes

This may break support for some deeply-nested Nix expressions. I assume that many of these were getting stack overflows before anyway, but maybe not.

Further context

N/A

aaronjanse commented 2 years ago

We might also want to consider looking into the decurse crate

oberblastmeister commented 2 years ago

Do we need a test? I think stack size can vary also

aaronjanse commented 2 years ago

Stack size definitely varies. Do you think I should remove the test?

oberblastmeister commented 2 years ago

Yeah I think so

aaronjanse commented 2 years ago

Sounds good. Done in https://github.com/nix-community/rnix-parser/pull/119/commits/b217b2a21251dc664fddd5a7efade45090c0cc4d