Skip to content

fix: reject invalid data sizes#454

Open
JSap0914 wants to merge 1 commit into
cubic-vm:mainfrom
JSap0914:codex/fix-data-size-parsing
Open

fix: reject invalid data sizes#454
JSap0914 wants to merge 1 commit into
cubic-vm:mainfrom
JSap0914:codex/fix-data-size-parsing

Conversation

@JSap0914

@JSap0914 JSap0914 commented Jul 4, 2026

Copy link
Copy Markdown

Fixes #449.

Summary

  • split data-size suffixes on UTF-8 character boundaries instead of byte offsets
  • use checked arithmetic when applying B/K/M/G/T multipliers
  • add regression tests for multibyte suffixes and overflowing values

Validation

  • cargo test test_rejects -- --nocapture
  • cargo test
  • cargo fmt --all -- --check
  • cargo clippy -- -D warnings
  • LSP diagnostics for src/models/data_size.rs: no diagnostics found
  • cargo run -- create demo --disk '10€' -i ubuntu:noble
  • cargo run -- create demo --disk '18446744073709551615T' -i ubuntu:noble

Copilot AI review requested due to automatic review settings July 4, 2026 22:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@rogkne

rogkne commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Thanks @JSap0914. The change looks good!
Please add a test case for an empty string (DataSize::from_str("")) and resolve the CI failure.

@rogkne rogkne left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JSap0914 Please address the requested changes. If the requested changes aren't addressed, we'll need to close this PR.

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.

[Bug]: Data size parsing panics on some inputs and overflows on large values

3 participants