Skip to content

fix(config): reject min-size values that overflow - #647

Open
lee3Q wants to merge 1 commit into
bootandy:masterfrom
lee3Q:lee3Q-patch-1
Open

lee3Q wants to merge 1 commit into
bootandy:masterfrom
lee3Q:lee3Q-patch-1

Conversation

@lee3Q

@lee3Q lee3Q commented Nov 4, 2026

Copy link
Copy Markdown

convert_min_size multiplied the parsed number by the unit without an overflow check, and silently ignored numbers that do not fit in usize.

  • dust -z 99999999T panics in debug builds ("attempt to multiply with overflow") and wraps silently in release builds, so the filter ends up with a wrong size.
  • dust -z 18446744073709551616 was dropped with no message, unlike other invalid values.

This uses checked_mul and treats any value that can't be represented like the other invalid values: it prints Ignoring invalid min-size: <input> and the option is ignored.

Behavior changes to be aware of:

  • Numbers above usize::MAX now print the existing "Ignoring invalid min-size" warning instead of being dropped silently.
  • On 32-bit targets a T suffix value used to become Some(0) without a warning; it now gives None with the warning.

Testing: on x86_64 debug, the config unit tests pass (37), and the new assertions fail on the base commit and pass with this change. The integration tests have 4 failures that are identical with and without this change. I did not run 32-bit binaries (only a 32-bit cargo check --tests), and I did not get a fully green full test run.

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.

1 participant