You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(obs-util): config-file duplicate section/key lookup diverges from C after uthash bucket expansion #681
obs_util::config_file resolves duplicate section names and duplicate keys with "newest wins" (find_item in rust/obs-util/src/config_file.rs, .iter().rev().find(..)). The C original uses HASH_FIND_STR over uthash, and the parser adds duplicates with HASH_ADD_STR without looking them up first (parse_config_data, config_add_item in libobs/util/config-file.c). uthash prepends to the bucket chain, so newest wins only until the bucket expands. HASH_EXPAND_BUCKETS (vendored uthash.h around line 866) relinks every chain by prepending into the new buckets, which reverses the order of entries with the same key. After that, HASH_FIND_STR returns an older duplicate.
Reproduction
Found by the new config_ini_diff fuzz target (#144). Minimal input: ten identical section headers, with the key only in the last one:
[s] (x9)
[s]
k=v
C oracle: config_get_string(cfg, "s", "k") returns NULL. The tenth add reaches HASH_BKT_CAPACITY_THRESH (10), the expand reverses the chain, and the lookup lands on the first, empty [s].
Rust shim and Config::open_string: return ""/"v" from the last [s].
With 2, 11, 12 or 20 duplicates the results agree. Whether they agree depends on the expand history (expand_mult, ineff_expands/noexpand) and on how the other names hash, so a fixed "first" or "last" rule cannot match C. Duplicate keys inside one section take the same config_add_item path. config_set_item, config_remove_value and config_has_user_value use the same lookup, so writes can also target a different duplicate than C does.
Expected
The Rust port returns the same duplicate as C for every input, as the differential tier requires. That probably means modelling uthash's bucket placement and expansion (Jenkins hash, threshold 10, ineffective-expand cutoff) for duplicate resolution, or keeping one ordered chain per bucket.
Activity
test(fuzz): nightly differential fuzz runner, NAL and INI targets (#144…
zackees commentedon Oct 14, 2026
Claiming.
fix(obs-util): config_file duplicate section/key lookup follows uthash (