| 5092 | } |
| 5093 | |
| 5094 | static enum XML_Error PTRCALL |
| 5095 | externalParEntProcessor(XML_Parser parser, const char *s, const char *end, |
| 5096 | const char **nextPtr) { |
| 5097 | const char *next = s; |
| 5098 | int tok; |
| 5099 | |
| 5100 | tok = XmlPrologTok(parser->m_encoding, s, end, &next); |
| 5101 | if (tok <= 0) { |
| 5102 | if (! parser->m_parsingStatus.finalBuffer && tok != XML_TOK_INVALID) { |
| 5103 | *nextPtr = s; |
| 5104 | return XML_ERROR_NONE; |
| 5105 | } |
| 5106 | switch (tok) { |
| 5107 | case XML_TOK_INVALID: |
| 5108 | return XML_ERROR_INVALID_TOKEN; |
| 5109 | case XML_TOK_PARTIAL: |
| 5110 | return XML_ERROR_UNCLOSED_TOKEN; |
| 5111 | case XML_TOK_PARTIAL_CHAR: |
| 5112 | return XML_ERROR_PARTIAL_CHAR; |
| 5113 | case XML_TOK_NONE: /* start == end */ |
| 5114 | default: |
| 5115 | break; |
| 5116 | } |
| 5117 | } |
| 5118 | /* This would cause the next stage, i.e. doProlog to be passed XML_TOK_BOM. |
| 5119 | However, when parsing an external subset, doProlog will not accept a BOM |
| 5120 | as valid, and report a syntax error, so we have to skip the BOM, and |
| 5121 | account for the BOM bytes. |
| 5122 | */ |
| 5123 | else if (tok == XML_TOK_BOM) { |
| 5124 | if (! accountingDiffTolerated(parser, tok, s, next, __LINE__, |
| 5125 | XML_ACCOUNT_DIRECT)) { |
| 5126 | accountingOnAbort(parser); |
| 5127 | return XML_ERROR_AMPLIFICATION_LIMIT_BREACH; |
| 5128 | } |
| 5129 | |
| 5130 | s = next; |
| 5131 | tok = XmlPrologTok(parser->m_encoding, s, end, &next); |
| 5132 | } |
| 5133 | |
| 5134 | parser->m_processor = prologProcessor; |
| 5135 | return doProlog(parser, parser->m_encoding, s, end, tok, next, nextPtr, |
| 5136 | (XML_Bool)! parser->m_parsingStatus.finalBuffer, XML_TRUE, |
| 5137 | XML_ACCOUNT_DIRECT); |
| 5138 | } |
| 5139 | |
| 5140 | static enum XML_Error PTRCALL |
| 5141 | entityValueProcessor(XML_Parser parser, const char *s, const char *end, |
no test coverage detected
searching dependent graphs…