Skip to content

Raise SigmaValueError for non-finite SigmaNumber values - #526

Merged
thomaspatzke merged 1 commit into
SigmaHQ:mainfrom
SkxOverKill:fix/sigmanumber-non-finite
Aug 11, 2026
Merged

Raise SigmaValueError for non-finite SigmaNumber values#526
thomaspatzke merged 1 commit into
SigmaHQ:mainfrom
SkxOverKill:fix/sigmanumber-non-finite

Conversation

@SkxOverKill

Copy link
Copy Markdown
Contributor

SigmaNumber.post_init converted float('inf'), float('-inf') and float('nan') via int() without handling the resulting OverflowError, crashing rule parsing with a raw OverflowError instead of a SigmaValueError. This is reachable from rule files, since .inf/.nan are valid YAML floats (detection.py:151 passes them to sigma_type()).

Convert the value to float first and reject non-finite numbers with SigmaValueError('Invalid number'). Also catch OverflowError so oversized integers that overflow float conversion are reported as invalid numbers instead of raising unhandled.

SigmaNumber.__post_init__ converted float('inf'), float('-inf') and
float('nan') via int() without handling the resulting OverflowError,
crashing rule parsing with a raw OverflowError instead of a
SigmaValueError. This is reachable from rule files, since .inf/.nan are
valid YAML floats (detection.py:151 passes them to sigma_type()).

Convert the value to float first and reject non-finite numbers with
SigmaValueError('Invalid number'). Also catch OverflowError so oversized
integers that overflow float conversion are reported as invalid numbers
instead of raising unhandled.
@thomaspatzke
thomaspatzke merged commit 8631f64 into SigmaHQ:main Aug 11, 2026
20 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.

2 participants