Skip to content

split: avoid arithmetic overflow on a huge numeric or hex suffix start value - #14092

Open
SAY-5 wants to merge 1 commit into
uutils:mainfrom
SAY-5:split-fix-suffix-start-overflow
Open

split: avoid arithmetic overflow on a huge numeric or hex suffix start value#14092
SAY-5 wants to merge 1 commit into
uutils:mainfrom
SAY-5:split-fix-suffix-start-overflow

Conversation

@SAY-5

@SAY-5 SAY-5 commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #13749.

When split auto-computes the suffix length it adds the suffix start value (--numeric-suffixes=N / --hex-suffixes=N) to the chunk count as start as u64 + chunks. A start value near u64::MAX overflows that add and panics with attempt to add with overflow under overflow checks (exit 134).

This uses saturating_add so the auto-width calculation no longer overflows; an out-of-range start value now flows into the existing suffix-length error instead of aborting.

Added regression tests for --numeric-suffixes and --hex-suffixes start values near u64::MAX.

…t value

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
@codspeed-hq

codspeed-hq Bot commented Aug 23, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 3.76%

⚡ 2 improved benchmarks
✅ 355 untouched benchmarks
⏩ 50 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation cksum_crc32b 39.7 ms 38.1 ms +4.19%
Simulation cksum_sysv 68.4 ms 66.2 ms +3.32%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing SAY-5:split-fix-suffix-start-overflow (d171ceb) with main (9875296)

Open in CodSpeed

Footnotes

  1. 50 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/tail/truncate. tests/tail/truncate is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/tail-n0f (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/cp/link-heap is now passing!

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.

split: arithmetic overflow (overflow-checks) on a huge --numeric-suffixes/--hex-suffixes start value

1 participant