fix: reject a configuration entry with an empty value1

A line such as "=z" parsed into the pair ("", "z"). An empty value1
matches at every position and consumes nothing, so the scan in
replace_line never advanced and the program looped forever, printing
nothing and growing its output buffer until it was killed.

Reject the entry while parsing, reporting the offending line the same
way as a line with no "=" at all, and document the termination
invariant the loop depends on.
This commit is contained in:
2026-08-26 14:35:32 +02:00
parent 721d21a603
commit dc401be837
3 changed files with 35 additions and 1 deletions

View File

@@ -24,6 +24,8 @@ def replace_line(line: str, pairs: list[tuple[str, str]]) -> tuple[str, int]:
replaced_symbols = 0
position = 0
# Terminates because every branch below advances `position`, which
# holds only while no value1 is empty. `load_config` rejects those.
while position < len(line):
match = None