Skip to content

dd: short-circuit multiplier on zero factor - #14182

Open
MadeNavaneeth wants to merge 1 commit into
uutils:mainfrom
MadeNavaneeth:fix/dd-zero-factor
Open

dd: short-circuit multiplier on zero factor#14182
MadeNavaneeth wants to merge 1 commit into
uutils:mainfrom
MadeNavaneeth:fix/dd-zero-factor

Conversation

@MadeNavaneeth

Copy link
Copy Markdown
Contributor

When a zero factor appears in a multiplier expression (e.g. count=00x999...), GNU dd short-circuits and returns 0 without parsing the remaining factors. Our implementation parsed all factors first, so a huge number in a later factor could fail with "Value too large" even though the product is zero.

Fix by checking the parsed value: if it is zero and not the last factor, return 0 immediately after showing the zero-multiplier warning.

Fixes #14160

@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/tail/retry (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/dd/misc is no longer failing!
Congrats! The gnu test tests/csplit/csplit-heap is now passing!
Congrats! The gnu test tests/seq/seq-epipe is now passing!

When a zero factor appears in a multiplier expression (e.g. `00x999...`),
GNU dd short-circuits and returns 0 without parsing the remaining factors.
Our implementation parsed all factors first, so a huge number in a later
factor could fail with "Value too large" even though the product is zero.
Fix by checking the parsed value: if it is zero and not the last factor,
return 0 immediately after showing the zero-multiplier warning.
Fixes uutils#14160

@sylvestre sylvestre 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.

Sorry it needs a test

@sylvestre

Copy link
Copy Markdown
Contributor

And unbreak rhe ci :)

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.

dd: a zero factor no longer short-circuits the multiplier

2 participants