Skip to content

util: Fix os_dtostr leaving exponent tail digits behind - #796

Merged
zackees merged 2 commits into
masterfrom
fix/754-dtostr-exponent
Oct 15, 2026
Merged

zackees merged 2 commits into
masterfrom
fix/754-dtostr-exponent

Conversation

@zackees

@zackees zackees commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Fixes #754.

RED (util: Test os_dtostr exponent normalization round-trips): new Tier 2 file test/cmocka/test_dtostr_exponent.c (no existing C test edited) and dtostr_exponent_round_trips in rust/obs-util/tests/config_file_parity.rs. It fails with left: "1.5e-55", right: "1.5e-5" on both the C oracle and Rust.

GREEN: memmove now carries the NUL in libobs/util/platform.c and in the oracle copy, and the Rust dtostr uses drain instead of copy_within. soldr cargo test -p obs-util passes locally; Tier 2 is left to PR CI.

Config values already written in the corrupted form stay wrong; this only stops new ones.

@zackees
zackees marked this pull request as ready for review October 15, 2026 02:13
@zackees

zackees commented Oct 15, 2026

Copy link
Copy Markdown
Member Author

macOS Tier 2 failed linking libobs (MacOSX27.0.sdk ... unknown architecture), the known flake #777; test_dtostr_exponent passed in that job. Re-ran that single job.

@zackees
zackees added this pull request to the merge queue Oct 15, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 15, 2026
memmove now carries the NUL, so the removed '+' and leading zeros no
longer leave the old tail digits behind. Same change in the C oracle and
the Rust port.

Fixes #754
@zackees

zackees commented Oct 15, 2026

Copy link
Copy Markdown
Member Author

Rebased onto master to resolve a doc-comment conflict with #739 (kept its inf.0/nan.0 note). config_file_parity and ./lint pass locally.

@zackees
zackees force-pushed the fix/754-dtostr-exponent branch from 131e443 to 29a2411 Compare October 15, 2026 04:14
@zackees
zackees enabled auto-merge October 15, 2026 04:14
@zackees
zackees added this pull request to the merge queue Oct 15, 2026
Merged via the queue into master with commit e338e03 Oct 15, 2026
22 checks passed
@zackees
zackees deleted the fix/754-dtostr-exponent branch October 26, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bug: libobs/util: os_dtostr corrupts exponents (1e17 -> "1e177", 1.5e-5 -> "1.5e-55"), so config_set_double does not round-trip; the Rust port copies it

1 participant