| 2630 | } |
| 2631 | |
| 2632 | static enum XML_Error PTRCALL |
| 2633 | externalEntityInitProcessor2(XML_Parser parser, const char *start, |
| 2634 | const char *end, const char **endPtr) { |
| 2635 | const char *next = start; /* XmlContentTok doesn't always set the last arg */ |
| 2636 | int tok = XmlContentTok(parser->m_encoding, start, end, &next); |
| 2637 | switch (tok) { |
| 2638 | case XML_TOK_BOM: |
| 2639 | #ifdef XML_DTD |
| 2640 | if (! accountingDiffTolerated(parser, tok, start, next, __LINE__, |
| 2641 | XML_ACCOUNT_DIRECT)) { |
| 2642 | accountingOnAbort(parser); |
| 2643 | return XML_ERROR_AMPLIFICATION_LIMIT_BREACH; |
| 2644 | } |
| 2645 | #endif /* XML_DTD */ |
| 2646 | |
| 2647 | /* If we are at the end of the buffer, this would cause the next stage, |
| 2648 | i.e. externalEntityInitProcessor3, to pass control directly to |
| 2649 | doContent (by detecting XML_TOK_NONE) without processing any xml text |
| 2650 | declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent. |
| 2651 | */ |
| 2652 | if (next == end && ! parser->m_parsingStatus.finalBuffer) { |
| 2653 | *endPtr = next; |
| 2654 | return XML_ERROR_NONE; |
| 2655 | } |
| 2656 | start = next; |
| 2657 | break; |
| 2658 | case XML_TOK_PARTIAL: |
| 2659 | if (! parser->m_parsingStatus.finalBuffer) { |
| 2660 | *endPtr = start; |
| 2661 | return XML_ERROR_NONE; |
| 2662 | } |
| 2663 | parser->m_eventPtr = start; |
| 2664 | return XML_ERROR_UNCLOSED_TOKEN; |
| 2665 | case XML_TOK_PARTIAL_CHAR: |
| 2666 | if (! parser->m_parsingStatus.finalBuffer) { |
| 2667 | *endPtr = start; |
| 2668 | return XML_ERROR_NONE; |
| 2669 | } |
| 2670 | parser->m_eventPtr = start; |
| 2671 | return XML_ERROR_PARTIAL_CHAR; |
| 2672 | } |
| 2673 | parser->m_processor = externalEntityInitProcessor3; |
| 2674 | return externalEntityInitProcessor3(parser, start, end, endPtr); |
| 2675 | } |
| 2676 | |
| 2677 | static enum XML_Error PTRCALL |
| 2678 | externalEntityInitProcessor3(XML_Parser parser, const char *start, |
no test coverage detected