mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-24 06:50:08 +03:00
parser: Fix regression when push parsing parameter entities
Short-lived regression from 834b8123. Also shrink parameter entity buffers when push parsing.
This commit is contained in:
parent
134d2ad890
commit
b76d81dab3
6
parser.c
6
parser.c
@ -2261,13 +2261,11 @@ static int spacePop(xmlParserCtxtPtr ctxt) {
|
||||
xmlParserGrow(ctxt); \
|
||||
} while (0)
|
||||
|
||||
#define SHRINK if ((ctxt->progressive == 0) && \
|
||||
(ctxt->input->cur - ctxt->input->base > 2 * INPUT_CHUNK) && \
|
||||
#define SHRINK if ((ctxt->input->cur - ctxt->input->base > 2 * INPUT_CHUNK) && \
|
||||
(ctxt->input->end - ctxt->input->cur < 2 * INPUT_CHUNK)) \
|
||||
xmlParserShrink(ctxt);
|
||||
|
||||
#define GROW if ((ctxt->progressive == 0) && \
|
||||
(ctxt->input->end - ctxt->input->cur < INPUT_CHUNK)) \
|
||||
#define GROW if (ctxt->input->end - ctxt->input->cur < INPUT_CHUNK) \
|
||||
xmlParserGrow(ctxt);
|
||||
|
||||
#define SKIP_BLANKS xmlSkipBlankChars(ctxt)
|
||||
|
@ -519,7 +519,7 @@ xmlParserGrow(xmlParserCtxtPtr ctxt) {
|
||||
if (buf == NULL)
|
||||
return(0);
|
||||
/* Don't grow push parser buffer. */
|
||||
if (ctxt->progressive)
|
||||
if ((ctxt->progressive) && (ctxt->inputNr <= 1))
|
||||
return(0);
|
||||
if (buf->error != 0)
|
||||
return(-1);
|
||||
@ -603,10 +603,9 @@ xmlParserShrink(xmlParserCtxtPtr ctxt) {
|
||||
xmlParserInputBufferPtr buf = in->buf;
|
||||
size_t used;
|
||||
|
||||
/* Don't shrink pull parser memory buffers. */
|
||||
/* Don't shrink push parser buffer. */
|
||||
if ((buf == NULL) ||
|
||||
((ctxt->progressive == 0) &&
|
||||
(buf->encoder == NULL) && (buf->readcallback == NULL)))
|
||||
((ctxt->progressive) && (ctxt->inputNr <= 1)))
|
||||
return;
|
||||
|
||||
used = in->cur - in->base;
|
||||
|
6
result/valid/huge.xml
Normal file
6
result/valid/huge.xml
Normal file
File diff suppressed because one or more lines are too long
7
result/valid/pe-latin1.xml
Normal file
7
result/valid/pe-latin1.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE doc [
|
||||
<!ELEMENT doc (#PCDATA)>
|
||||
<!ENTITY % pe SYSTEM "dtds/pe-latin1.ent">
|
||||
<!ENTITY latin1 "äöü">
|
||||
]>
|
||||
<doc>&latin1;</doc>
|
104
test/valid/dtds/huge.ent
Normal file
104
test/valid/dtds/huge.ent
Normal file
@ -0,0 +1,104 @@
|
||||
<!-- More than MINLEN (4000) bytes of comments -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
<!-- ................................................................. -->
|
||||
|
||||
<!ELEMENT doc (#PCDATA)>
|
2
test/valid/dtds/pe-latin1.ent
Normal file
2
test/valid/dtds/pe-latin1.ent
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!ENTITY latin1 "äöü">
|
5
test/valid/huge.xml
Normal file
5
test/valid/huge.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<!DOCTYPE doc [
|
||||
<!ENTITY % pe SYSTEM "dtds/huge.ent">
|
||||
%pe;
|
||||
]>
|
||||
<doc>test</doc>
|
6
test/valid/pe-latin1.xml
Normal file
6
test/valid/pe-latin1.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<!DOCTYPE doc [
|
||||
<!ELEMENT doc (#PCDATA)>
|
||||
<!ENTITY % pe SYSTEM "dtds/pe-latin1.ent">
|
||||
%pe;
|
||||
]>
|
||||
<doc>&latin1;</doc>
|
Loading…
x
Reference in New Issue
Block a user