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

Fix RecursionError: Limit depth of nested Objects when generating fuzz parameters #89

Merged
merged 1 commit into from
Feb 23, 2024

Conversation

Chandra158
Copy link
Contributor

@Chandra158 Chandra158 commented Jan 31, 2024

Overview

...
...
  File "/github/fuzz-lightyear/fuzz_lightyear/fuzzer.py", line 81, in _fuzz_parameter
    strategy = fuzz_fn(parameter, operation_id, required=required)  # type: ignore
  File "/github/fuzz-lightyear/fuzz_lightyear/fuzzer.py", line 178, in _fuzz_array
    elements=_fuzz_parameter(item, operation_id, required=required),
  File "/github/fuzz-lightyear/fuzz_lightyear/fuzzer.py", line 81, in _fuzz_parameter
    strategy = fuzz_fn(parameter, operation_id, required=required)  # type: ignore
  File "/github/fuzz-lightyear/fuzz_lightyear/fuzzer.py", line 213, in _fuzz_object
    if strategy:
...
...
packages/hypothesis/strategies/_internal/lazy.py", line 139, in __repr__
    sig = signature(self.function)
  File "/usr/lib/python3.8/inspect.py", line 3105, in signature
    return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
...
...
  File "/usr/lib/python3.8/enum.py", line 339, in __call__
    return cls.__new__(cls, value)
RecursionError: maximum recursion depth exceeded while calling a Python object
  • APPSEC-5131
  • For self-referencing Objects, generating fuzz parameters results in a non-ending recursive call
  • In this PR:
    • fixing the nested object depth to a max limit
    • this limit ( --depth) can be passed as an argument (default=6)

fuzz_lightyear/usage.py Show resolved Hide resolved
fuzz_lightyear/main.py Show resolved Hide resolved
@Chandra158 Chandra158 merged commit dc04123 into master Feb 23, 2024
3 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