Skip to content

Harden YAML parser against nested structures#6

Merged
osaether merged 1 commit into
mainfrom
fix/yaml-parser-hardening
Jun 6, 2026
Merged

Harden YAML parser against nested structures#6
osaether merged 1 commit into
mainfrom
fix/yaml-parser-hardening

Conversation

@osaether

@osaether osaether commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Summary

Two parsing-robustness fixes surfaced during a static review of the input path.

  • src/input.c — adds a depth-tracking skip_node() helper. Stray nested mappings/sequences (a top-level array beside conductors, or an inner map/seq inside a conductor block) previously knocked the alternating key/value state machine out of parity, causing the parser to swallow the conductors key and abort with need at least 2 conductors. Such nodes are now cleanly skipped.
  • tools/fh_crosscheck/geometry.py — coerces nw/nh with round(float(value)) to match the C parser's (int)round(safe_atof(value)), so float literals like nw: 21.0 are accepted with identical rounding (no truncation mismatch).

Test plan

  • python3 -m pytest tools/fh_crosscheck/19 passed

Notes

  • test.yaml was inadvertently overwritten with a bug-repro fixture during development; it has been restored and is not part of this PR.

🤖 Generated with Claude Code

…rosscheck

src/input.c: add a depth-tracking skip_node() so stray nested mappings or
sequences (e.g. a top-level array beside `conductors`, or an inner map/seq
inside a conductor block) are cleanly skipped instead of throwing the
key/value state machine out of parity and aborting with "need at least 2
conductors".

tools/fh_crosscheck/geometry.py: coerce nw/nh with round(float(value)) to
match the C parser's (int)round(safe_atof(value)), accepting float literals
without truncation mismatch.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@osaether osaether merged commit acda79f into main Jun 6, 2026
1 check passed
@osaether osaether deleted the fix/yaml-parser-hardening branch June 8, 2026 18:31
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.

1 participant