Skip to content

xml BUGFIX unexpected end of input after '<' - #2663

Open
Mohil-Ahuja wants to merge 1 commit into
CESNET:develfrom
Mohil-Ahuja:xml-eof-after-otag
Open

Mohil-Ahuja wants to merge 1 commit into
CESNET:develfrom
Mohil-Ahuja:xml-eof-after-otag

Conversation

@Mohil-Ahuja

Copy link
Copy Markdown

When the input ends right after a <, lyxml_skip_until_end_or_after_otag() returns as if the document had ended, even with elements still open. So with a zero-terminated input,

lyd_parse_data_mem(ctx, "<cp xmlns=\"urn:tests:a\"><y>v</y><", LYD_XML, 0, LYD_VALIDATE_PRESENT, &tree);

returns LY_SUCCESS with a tree on a release build. A debug build hits assert(xmlctx->status == LYXML_ELEM_CLOSE) in lydxml_subtree_r(). It now fails with "Unexpected end-of-input." A test case is added to test_container in test_parser_xml.c.

A '<' followed by the terminating zero of an input without a length was
treated as the end of the document even with elements still open, so a
truncated document such as '<cp xmlns="urn:tests:a"><' was accepted.
Report the unexpected end of input instead.
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