Skip to content

fix(xml): verify nested closing tag names in readContent#149

Merged
vmvarela merged 2 commits into
masterfrom
issue-134/xml-verify-nested-closing-tags
May 10, 2026
Merged

fix(xml): verify nested closing tag names in readContent#149
vmvarela merged 2 commits into
masterfrom
issue-134/xml-verify-nested-closing-tags

Conversation

@vmvarela
Copy link
Copy Markdown
Owner

Summary

  • Adds an internal ArrayList([]const u8) tag stack inside XmlParser.readContent to track open nested element names
  • On each closing tag at depth > 0, verifies the name matches the top of the stack; calls fatalAt on mismatch
  • Adds a unit test (XmlParser.readContent: properly matched nested tags are accepted) verifying the stack mechanism handles deeply nested valid XML correctly
  • Adds integration test 132 verifying that malformed XML like <a>text</b> exits non-zero

Changes

  • src/xml.zig: readContent — replace discarded _ = self.readName() with stack push/pop + verification; add unit test
  • build.zig: integration test 132 for mismatched nested closing tag

Closes #134

Maintain a tag stack inside XmlParser.readContent so that every
closing tag of a nested element is validated against the name of
the element that opened it.  Previously the name was read and
silently discarded, accepting malformed XML like
<col><a>text</b></col> without error.

Closes #134
@vmvarela vmvarela added type:chore Maintenance, refactoring, tooling priority:low Nice to have, do when possible size:s Small — 1 to 4 hours tech-debt Technical debt — address proactively labels May 10, 2026
@github-actions github-actions Bot added type:bug Something isn't working and removed type:chore Maintenance, refactoring, tooling labels May 10, 2026
@vmvarela vmvarela merged commit 89ad439 into master May 10, 2026
4 checks passed
@vmvarela vmvarela deleted the issue-134/xml-verify-nested-closing-tags branch May 10, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:low Nice to have, do when possible size:s Small — 1 to 4 hours tech-debt Technical debt — address proactively type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

xml: verify nested closing tag names in readContent

1 participant