Permalink
Browse files

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
  • Loading branch information...
1 parent 6795260 commit a617e24f32c8b2fd7ec68c77389dbac6702ee85d Daniel Veillard committed Jan 9, 2006
Showing with 70 additions and 6 deletions.
  1. +7 −0 ChangeLog
  2. +11 −6 parser.c
  3. +5 −0 result/ent11
  4. +5 −0 result/ent11.rde
  5. +4 −0 result/ent11.rdr
  6. +13 −0 result/ent11.sax
  7. +13 −0 result/ent11.sax2
  8. +6 −0 result/noent/ent11
  9. +6 −0 test/ent11
View
@@ -1,3 +1,10 @@
+Mon Jan 9 15:33:16 CET 2006 Daniel Veillard <daniel@veillard.com>
+
+ * 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
+
Thu Jan 5 16:25:06 CET 2006 Daniel Veillard <daniel@veillard.com>
* NEWS configure.in libxml.spec.in testapi.c doc/*: upated the news
View
@@ -3539,16 +3539,12 @@ xmlParseCharData(xmlParserCtxtPtr ctxt, int cdata) {
ctxt->input->cur = in;
if (*in == 0xD) {
in++;
- if (!*in) /* if end of current chunk return */
- return;
if (*in == 0xA) {
ctxt->input->cur = in;
in++;
ctxt->input->line++; ctxt->input->col = 1;
continue; /* while */
}
- if (!*in) /* if end of current chunk return */
- return;
in--;
}
if (*in == '<') {
@@ -3931,8 +3927,6 @@ xmlParseComment(xmlParserCtxtPtr ctxt) {
ctxt->input->line++; ctxt->input->col = 1;
continue; /* while */
}
- if (!*in) /* if end of current chunk return */
- return;
in--;
}
SHRINK;
@@ -10407,12 +10401,19 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
int
xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size,
int terminate) {
+ int end_in_lf = 0;
+
if (ctxt == NULL)
return(XML_ERR_INTERNAL_ERROR);
if ((ctxt->errNo != XML_ERR_OK) && (ctxt->disableSAX == 1))
return(ctxt->errNo);
if (ctxt->instate == XML_PARSER_START)
xmlDetectSAX2(ctxt);
+ if ((size > 0) && (chunk != NULL) && (!terminate) &&
+ (chunk[size - 1] == '\r')) {
+ end_in_lf = 1;
+ size--;
+ }
if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) &&
(ctxt->input->buf != NULL) && (ctxt->instate != XML_PARSER_EOF)) {
int base = ctxt->input->base - ctxt->input->buf->buffer->content;
@@ -10451,6 +10452,10 @@ xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size,
}
}
xmlParseTryOrFinish(ctxt, terminate);
+ if ((end_in_lf == 1) && (ctxt->input != NULL) &&
+ (ctxt->input->buf != NULL)) {
+ xmlParserInputBufferPush(ctxt->input->buf, 1, "\r");
+ }
if ((ctxt->errNo != XML_ERR_OK) && (ctxt->disableSAX == 1))
return(ctxt->errNo);
if (terminate) {
View
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE doc [
+<!ENTITY newl "&#13;">
+]>
+<doc>&newl;</doc>
View
@@ -0,0 +1,5 @@
+0 10 doc 0 0
+0 1 doc 0 0
+1 14 #text 0 1
+
+0 15 doc 0 0
View
@@ -0,0 +1,4 @@
+0 10 doc 0 0
+0 1 doc 0 0
+1 5 newl 0 0
+0 15 doc 0 0
View
@@ -0,0 +1,13 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.internalSubset(doc, , )
+SAX.entityDecl(newl, 1, (null), (null), )
+SAX.getEntity(newl)
+SAX.externalSubset(doc, , )
+SAX.startElement(doc)
+SAX.getEntity(newl)
+SAX.characters(
+, 1)
+SAX.reference(newl)
+SAX.endElement(doc)
+SAX.endDocument()
View
@@ -0,0 +1,13 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.internalSubset(doc, , )
+SAX.entityDecl(newl, 1, (null), (null), )
+SAX.getEntity(newl)
+SAX.externalSubset(doc, , )
+SAX.startElementNs(doc, NULL, NULL, 0, 0, 0)
+SAX.getEntity(newl)
+SAX.characters(
+, 1)
+SAX.reference(newl)
+SAX.endElementNs(doc, NULL, NULL)
+SAX.endDocument()
View
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE doc [
+<!ENTITY newl "&#13;">
+]>
+<doc>
+</doc>
View
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE doc [
+ <!ENTITY newl "&#13;">
+]>
+
+<doc>&newl;</doc>

0 comments on commit a617e24

Please sign in to comment.