Skip to content

fix(cli): prevent overflow panic in --since parsing#38

Merged
luca-ctx merged 1 commit into
ctxrs:mainfrom
atharva-patill:fix/since-overflow
Jul 3, 2026
Merged

fix(cli): prevent overflow panic in --since parsing#38
luca-ctx merged 1 commit into
ctxrs:mainfrom
atharva-patill:fix/since-overflow

Conversation

@atharva-patill

Copy link
Copy Markdown
Contributor

Summary

While testing --since, I noticed that passing a very large day value (for example 500000000d) causes the CLI to panic because of unchecked date arithmetic.

This changes that behavior to return a normal user-facing error instead of panicking. I've also added a regression test to cover this case.

Before

$ ctx search foo --since 500000000d

thread 'main' panicked at crates/ctx-cli/src/main.rs:6417:19:
DateTime - TimeDelta overflowed

After

$ ctx search foo --since 500000000d

Error: invalid --since day window: 500000000d: value too large

Validation

  • Added a regression test for oversized --since values
  • Relevant unit tests pass

@luca-ctx luca-ctx merged commit 34e29f9 into ctxrs:main Jul 3, 2026
@luca-ctx

luca-ctx commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Thank you for the bugfix!

@atharva-patill

Copy link
Copy Markdown
Contributor Author

Thank you for the bugfix!

@luca-ctx You're welcome!

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