| 6398 | } |
| 6399 | |
| 6400 | static enum XML_Error PTRCALL |
| 6401 | internalEntityProcessor(XML_Parser parser, const char *s, const char *end, |
| 6402 | const char **nextPtr) { |
| 6403 | UNUSED_P(s); |
| 6404 | UNUSED_P(end); |
| 6405 | UNUSED_P(nextPtr); |
| 6406 | ENTITY *entity; |
| 6407 | const char *textStart, *textEnd; |
| 6408 | const char *next; |
| 6409 | enum XML_Error result; |
| 6410 | OPEN_INTERNAL_ENTITY *openEntity = parser->m_openInternalEntities; |
| 6411 | if (! openEntity) |
| 6412 | return XML_ERROR_UNEXPECTED_STATE; |
| 6413 | |
| 6414 | entity = openEntity->entity; |
| 6415 | |
| 6416 | // This will return early |
| 6417 | if (entity->hasMore) { |
| 6418 | textStart = ((const char *)entity->textPtr) + entity->processed; |
| 6419 | textEnd = (const char *)(entity->textPtr + entity->textLen); |
| 6420 | /* Set a safe default value in case 'next' does not get set */ |
| 6421 | next = textStart; |
| 6422 | |
| 6423 | if (entity->is_param) { |
| 6424 | int tok |
| 6425 | = XmlPrologTok(parser->m_internalEncoding, textStart, textEnd, &next); |
| 6426 | result = doProlog(parser, parser->m_internalEncoding, textStart, textEnd, |
| 6427 | tok, next, &next, XML_FALSE, XML_FALSE, |
| 6428 | XML_ACCOUNT_ENTITY_EXPANSION); |
| 6429 | } else { |
| 6430 | result = doContent(parser, openEntity->startTagLevel, |
| 6431 | parser->m_internalEncoding, textStart, textEnd, &next, |
| 6432 | XML_FALSE, XML_ACCOUNT_ENTITY_EXPANSION); |
| 6433 | } |
| 6434 | |
| 6435 | if (result != XML_ERROR_NONE) |
| 6436 | return result; |
| 6437 | // Check if entity is complete, if not, mark down how much of it is |
| 6438 | // processed |
| 6439 | if (textEnd != next |
| 6440 | && (parser->m_parsingStatus.parsing == XML_SUSPENDED |
| 6441 | || (parser->m_parsingStatus.parsing == XML_PARSING |
| 6442 | && parser->m_reenter))) { |
| 6443 | entity->processed = (int)(next - (const char *)entity->textPtr); |
| 6444 | return result; |
| 6445 | } |
| 6446 | |
| 6447 | // Entity is complete. We cannot close it here since we need to first |
| 6448 | // process its possible inner entities (which are added to the |
| 6449 | // m_openInternalEntities during doProlog or doContent calls above) |
| 6450 | entity->hasMore = XML_FALSE; |
| 6451 | if (! entity->is_param |
| 6452 | && (openEntity->startTagLevel != parser->m_tagLevel)) { |
| 6453 | return XML_ERROR_ASYNC_ENTITY; |
| 6454 | } |
| 6455 | triggerReenter(parser); |
| 6456 | return result; |
| 6457 | } // End of entity processing, "if" block will return here |
nothing calls this directly
no test coverage detected
searching dependent graphs…