diff --git a/src/dom/sgml/scanner.c b/src/dom/sgml/scanner.c index 3b887dcba..a372c9a59 100644 --- a/src/dom/sgml/scanner.c +++ b/src/dom/sgml/scanner.c @@ -129,6 +129,48 @@ check_sgml_error(struct dom_scanner *scanner) return scanner->detect_errors && !found_error; } +static unsigned char * +get_sgml_error_end(struct dom_scanner *scanner, enum sgml_token_type type, + unsigned char *end) +{ + switch (type) { + case SGML_TOKEN_CDATA_SECTION: + case SGML_TOKEN_NOTATION_ATTLIST: + case SGML_TOKEN_NOTATION_DOCTYPE: + case SGML_TOKEN_NOTATION_ELEMENT: + if (scanner->position + 9 < end) + end = scanner->position + 9; + break; + + case SGML_TOKEN_NOTATION_COMMENT: + /* Just include the '