Skip to content

Reject non-finite and non-positive corpus checker timeouts #585

Closed

Description

@LunaStev

Problem

The corpus checker's --timeout argument uses type=float without validating the result. It accepts 0, negative values, nan, inf, and -inf, then forwards them as subprocess deadlines. These values do not provide the intended finite positive per-file time budget, and invalid input is not diagnosed at the CLI boundary.

Confirmed by invoking the actual argument parser on master ecb1637602ff409aab3d0c480fd9ec1e73e645ba. This report demonstrates input acceptance; it does not claim a particular crash or hang occurred in CI.

Reproduce from the repository root

python3 - <<'PYTHON'
import sys
from unittest.mock import patch
from tools.check_wave_corpus import parse_args

for value in ("0", "-1", "nan", "inf", "-inf", "0.25"):
    with patch.object(sys, "argv", ["check_wave_corpus.py", "--timeout=" + value]):
        print(value, "=>", parse_args().timeout)
PYTHON

Actual: every value is accepted, including all five invalid budgets. 0.25 is a valid fractional timeout and should remain accepted.

Starting points

  • tools/check_wave_corpus.py: parse_args, particularly --timeout.
  • Add focused argument-validation tests in tools/test_check_wave_corpus.py.

Small contribution scope

  • Require a finite value greater than zero at argument parsing, using the Python standard library.
  • Produce a concise argparse usage error naming --timeout and the accepted range.
  • Keep the 15-second default and positive fractional values.
  • Add table-driven tests for zero, negative values, NaN, both infinities, non-numeric input, the default, and positive values.
  • Confirm invalid input exits with status 2 before compiler discovery or process creation.

Done when

  • Invalid budgets fail immediately with an actionable message and no traceback.
  • --help, the default, and valid finite positive timeouts retain their behavior.
  • python3 -m unittest tools.test_check_wave_corpus passes after adding the focused test module.

No LLVM build, subprocess lifecycle redesign, or real sleeping compiler is necessary. #354 tracks broader corpus-checker test coverage; this issue is limited to fixing and testing this concrete CLI validation defect. The process-tree cleanup fixed in #507 is outside this task.

Activity

  1. added
    bug
    good first issue
    ci
    on Sep 11, 2026
  2. added a commit that references this issue on Sep 11, 2026
    c580361
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcigood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions