Skip to content

numfmt: prevent panic for --format precision > 65535 on remaining paths#13514

Merged
sylvestre merged 1 commit into
uutils:mainfrom
SAY-5:numfmt-precision-guard-remaining
Jul 23, 2026
Merged

numfmt: prevent panic for --format precision > 65535 on remaining paths#13514
sylvestre merged 1 commit into
uutils:mainfrom
SAY-5:numfmt-precision-guard-remaining

Conversation

@SAY-5

@SAY-5 SAY-5 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

#12600 guarded only the middle branch of the render match in transform_to, so numfmt --format=%.70000f 1.5 and numfmt --to=si --format %.70000f 1000000 still abort with Formatting argument out of range (#13483). This adds the same precision <= u16::MAX guard to the two remaining format!("{:.precision$}") branches.

While testing the suffix path I found round_with_precision also turns the value into NaN for precision >= 309, because 10f64.powf(precision) overflows to infinity and inf / inf is NaN. Rounding is a no-op at that scale anyway, so it now returns the value unchanged when the scale factor is not finite.

Closes #13483

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

codspeed-hq Bot commented Jul 22, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 3.47%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 338 untouched benchmarks
⏩ 46 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation ls_recursive_balanced_tree[(6, 4, 15)] 49.4 ms 51.2 ms -3.47%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing SAY-5:numfmt-precision-guard-remaining (2d43038) with main (0d6b21e)

Open in CodSpeed

Footnotes

  1. 46 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:

Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/retry (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/cut/bounded-memory (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)

@sylvestre
sylvestre merged commit ce061a9 into uutils:main Jul 23, 2026
162 of 164 checks passed
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.

numfmt still panics on a --format precision > 65535 (incomplete fix of #12600)

2 participants