Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit a617e24

Browse files
author
Daniel Veillard
committed
reverted first patches for #319279 which led to #326295 and fixed the
* parser.c: reverted first patches for #319279 which led to #326295 and fixed the problem in xmlParseChunk() instead * test/ent11 result//ent11*: added test for #326295 to the regression suite Daniel
1 parent 6795260 commit a617e24

File tree

9 files changed

+70
-6
lines changed

9 files changed

+70
-6
lines changed

Diff for: ChangeLog

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
Mon Jan 9 15:33:16 CET 2006 Daniel Veillard <[email protected]>
2+
3+
* parser.c: reverted first patches for #319279 which led to #326295
4+
and fixed the problem in xmlParseChunk() instead
5+
* test/ent11 result//ent11*: added test for #326295 to the regression
6+
suite
7+
18
Thu Jan 5 16:25:06 CET 2006 Daniel Veillard <[email protected]>
29

310
* NEWS configure.in libxml.spec.in testapi.c doc/*: upated the news

Diff for: parser.c

+11-6
Original file line numberDiff line numberDiff line change
@@ -3539,16 +3539,12 @@ xmlParseCharData(xmlParserCtxtPtr ctxt, int cdata) {
35393539
ctxt->input->cur = in;
35403540
if (*in == 0xD) {
35413541
in++;
3542-
if (!*in) /* if end of current chunk return */
3543-
return;
35443542
if (*in == 0xA) {
35453543
ctxt->input->cur = in;
35463544
in++;
35473545
ctxt->input->line++; ctxt->input->col = 1;
35483546
continue; /* while */
35493547
}
3550-
if (!*in) /* if end of current chunk return */
3551-
return;
35523548
in--;
35533549
}
35543550
if (*in == '<') {
@@ -3931,8 +3927,6 @@ xmlParseComment(xmlParserCtxtPtr ctxt) {
39313927
ctxt->input->line++; ctxt->input->col = 1;
39323928
continue; /* while */
39333929
}
3934-
if (!*in) /* if end of current chunk return */
3935-
return;
39363930
in--;
39373931
}
39383932
SHRINK;
@@ -10407,12 +10401,19 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
1040710401
int
1040810402
xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size,
1040910403
int terminate) {
10404+
int end_in_lf = 0;
10405+
1041010406
if (ctxt == NULL)
1041110407
return(XML_ERR_INTERNAL_ERROR);
1041210408
if ((ctxt->errNo != XML_ERR_OK) && (ctxt->disableSAX == 1))
1041310409
return(ctxt->errNo);
1041410410
if (ctxt->instate == XML_PARSER_START)
1041510411
xmlDetectSAX2(ctxt);
10412+
if ((size > 0) && (chunk != NULL) && (!terminate) &&
10413+
(chunk[size - 1] == '\r')) {
10414+
end_in_lf = 1;
10415+
size--;
10416+
}
1041610417
if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) &&
1041710418
(ctxt->input->buf != NULL) && (ctxt->instate != XML_PARSER_EOF)) {
1041810419
int base = ctxt->input->base - ctxt->input->buf->buffer->content;
@@ -10451,6 +10452,10 @@ xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size,
1045110452
}
1045210453
}
1045310454
xmlParseTryOrFinish(ctxt, terminate);
10455+
if ((end_in_lf == 1) && (ctxt->input != NULL) &&
10456+
(ctxt->input->buf != NULL)) {
10457+
xmlParserInputBufferPush(ctxt->input->buf, 1, "\r");
10458+
}
1045410459
if ((ctxt->errNo != XML_ERR_OK) && (ctxt->disableSAX == 1))
1045510460
return(ctxt->errNo);
1045610461
if (terminate) {

Diff for: result/ent11

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!DOCTYPE doc [
3+
<!ENTITY newl "&#13;">
4+
]>
5+
<doc>&newl;</doc>

Diff for: result/ent11.rde

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
0 10 doc 0 0
2+
0 1 doc 0 0
3+
1 14 #text 0 1
4+
5+
0 15 doc 0 0

Diff for: result/ent11.rdr

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
0 10 doc 0 0
2+
0 1 doc 0 0
3+
1 5 newl 0 0
4+
0 15 doc 0 0

Diff for: result/ent11.sax

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
SAX.setDocumentLocator()
2+
SAX.startDocument()
3+
SAX.internalSubset(doc, , )
4+
SAX.entityDecl(newl, 1, (null), (null), )
5+
SAX.getEntity(newl)
6+
SAX.externalSubset(doc, , )
7+
SAX.startElement(doc)
8+
SAX.getEntity(newl)
9+
SAX.characters(
10+
, 1)
11+
SAX.reference(newl)
12+
SAX.endElement(doc)
13+
SAX.endDocument()

Diff for: result/ent11.sax2

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
SAX.setDocumentLocator()
2+
SAX.startDocument()
3+
SAX.internalSubset(doc, , )
4+
SAX.entityDecl(newl, 1, (null), (null), )
5+
SAX.getEntity(newl)
6+
SAX.externalSubset(doc, , )
7+
SAX.startElementNs(doc, NULL, NULL, 0, 0, 0)
8+
SAX.getEntity(newl)
9+
SAX.characters(
10+
, 1)
11+
SAX.reference(newl)
12+
SAX.endElementNs(doc, NULL, NULL)
13+
SAX.endDocument()

Diff for: result/noent/ent11

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!DOCTYPE doc [
3+
<!ENTITY newl "&#13;">
4+
]>
5+
<doc>
6+
</doc>

Diff for: test/ent11

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<!DOCTYPE doc [
3+
<!ENTITY newl "&#13;">
4+
]>
5+
6+
<doc>&newl;</doc>

0 commit comments

Comments
 (0)