wavefnd / wavefnd/Wave

Reject integer overflow while parsing environment values

Open
#424 0 comments 0 reactions 0 assignees View on GitHub
bug good first issue needs testing
Dominant language
Rust
Stars
53
Forks
16
Avg merge
4h 22m
Merged PRs (30d)
46

Description

## Summary

`_env_parse_i64` accumulates digits with `value * 10 + digit` without checking the signed 64-bit range. Out-of-range environment values can therefore overflow instead of returning an error.

## Relevant code

- `std/env/parse.wave`
- `std/env/environ.wave`

## Scope

Add explicit overflow detection for positive and negative inputs, including the asymmetric `i64::MIN` boundary. Keep `env_get_i64` and `env_get_i32` returning an unsuccessful `EnvResult` for invalid input.

## Acceptance criteria

- Decimal `i64` minimum and maximum values parse successfully.
- Values one step outside either boundary are rejected.
- Leading `+` and `-` retain their current behavior.
- Empty, sign-only, and non-decimal strings remain rejected.
- `env_get_i32` continues to reject values outside the signed 32-bit range.
- Boundary regression cases are added to the test corpus.

Contributor guide

Open the contributing guide

Research direction

Start with std/env/parse.wave and std/env/environ.wave, then locate the existing test corpus for environment-value parsing. Add boundary regression cases for signed 64-bit and 32-bit values, and verify that invalid, empty, sign-only, and non-decimal inputs still return unsuccessful EnvResult values.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.