diff options
author | kwaclaw <kwaclaw> | 2004-03-16 04:41:54 +0000 |
---|---|---|
committer | kwaclaw <kwaclaw> | 2004-03-16 04:41:54 +0000 |
commit | 3370a61bec74e8672f0f8919e19eff7b5677a965 (patch) | |
tree | eaaa49a2ee4fdc3819d2291a9db725ff8e6f6b34 /lib/xmlparse.c | |
parent | 11f1cc73b0c3a6ca079bc5682461f9fbdc0d7d5d (diff) | |
download | libexpat-3370a61bec74e8672f0f8919e19eff7b5677a965.tar.gz |
When the parser was suspended while processing an internal entity,
an XML_ERROR_NO_ELEMENTS condition could happen.
The reason was that the internal entity's start tag level was not preserved
when parsing was suspended. This has been corrected.
Diffstat (limited to 'lib/xmlparse.c')
-rw-r--r-- | lib/xmlparse.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/xmlparse.c b/lib/xmlparse.c index 60e6ecf..2eb40b5 100644 --- a/lib/xmlparse.c +++ b/lib/xmlparse.c @@ -284,6 +284,7 @@ typedef struct open_internal_entity { const char *internalEventEndPtr; struct open_internal_entity *next; ENTITY *entity; + int startTagLevel; XML_Bool betweenDecl; /* WFC: PE Between Declarations */ } OPEN_INTERNAL_ENTITY; @@ -4568,6 +4569,7 @@ processInternalEntity(XML_Parser parser, ENTITY *entity, openEntity->next = openInternalEntities; openInternalEntities = openEntity; openEntity->entity = entity; + openEntity->startTagLevel = tagLevel; openEntity->betweenDecl = betweenDecl; openEntity->internalEventPtr = NULL; openEntity->internalEventEndPtr = NULL; @@ -4610,7 +4612,6 @@ internalEntityProcessor(XML_Parser parser, ENTITY *entity; const char *textStart, *textEnd; const char *next; - int processorTagLevel; enum XML_Error result; OPEN_INTERNAL_ENTITY *openEntity = openInternalEntities; if (!openEntity) @@ -4619,11 +4620,6 @@ internalEntityProcessor(XML_Parser parser, entity = openEntity->entity; textStart = ((char *)entity->textPtr) + entity->processed; textEnd = (char *)(entity->textPtr + entity->textLen); - /* compare with cdataSectionProcessor */ - if (parentParser) - processorTagLevel = 1; - else - processorTagLevel = 0; #ifdef XML_DTD if (entity->is_param) { @@ -4633,7 +4629,7 @@ internalEntityProcessor(XML_Parser parser, } else #endif /* XML_DTD */ - result = doContent(parser, processorTagLevel, internalEncoding, + result = doContent(parser, openEntity->startTagLevel, internalEncoding, textStart, textEnd, &next, XML_FALSE); if (result != XML_ERROR_NONE) @@ -4662,8 +4658,9 @@ internalEntityProcessor(XML_Parser parser, #endif /* XML_DTD */ { processor = contentProcessor; - return doContent(parser, processorTagLevel, encoding, s, end, nextPtr, - (XML_Bool)!finalBuffer); + /* see externalEntityContentProcessor vs contentProcessor */ + return doContent(parser, parentParser ? 1 : 0, encoding, s, end, + nextPtr, (XML_Bool)!finalBuffer); } } |