Skip to content

Conversation

@ryanfowler
Copy link
Owner

No description provided.

@ryanfowler ryanfowler requested a review from Copilot January 25, 2026 05:10
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive test coverage for XML formatting functionality and fixes a potential panic when processing malformed XML with excess closing tags. The fix prevents a slice out-of-bounds panic by checking if the stack is empty before attempting to pop elements.

Changes:

  • Added guard clause to handle malformed XML with more closing tags than opening tags
  • Implemented performance optimization with fast-path check in escapeXMLString
  • Added comprehensive test suite covering valid XML, malformed XML, output verification, and XML string escaping

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
internal/format/xml.go Added stack length validation before popping elements to prevent panic; added fast-path optimization for XML string escaping
internal/format/xml_test.go Added comprehensive test coverage for XML formatting, malformed XML handling, and string escaping

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ryanfowler ryanfowler merged commit d20dd16 into main Jan 25, 2026
10 checks passed
@ryanfowler ryanfowler deleted the xml-fix branch January 25, 2026 05:12
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.

2 participants