components/libxml2/patches/13.CVE-2011-3905.patch
changeset 1044 ab6b15638457
parent 1043 585b09419d1c
child 1045 2dbef0a33dc7
equal deleted inserted replaced
1043:585b09419d1c 1044:ab6b15638457
     1 This patch copied/pasted from this link:
       
     2 http://git.gnome.org/browse/libxml2/patch/?id=77404b8b69bc122d12231807abf1a837d121b551
       
     3 ----------------------------------------------------------------------
       
     4 From 77404b8b69bc122d12231807abf1a837d121b551 Mon Sep 17 00:00:00 2001
       
     5 From: Chris Evans <[email protected]>
       
     6 Date: Wed, 14 Dec 2011 08:18:25 +0000
       
     7 Subject: Make sure the parser returns when getting a Stop order
       
     8 
       
     9 patch backported from chromiun bug fixes, assuming author is Chris
       
    10 ---
       
    11 diff --git a/parser.c b/parser.c
       
    12 index 21d7aa3..4e5dcb9 100644
       
    13 --- a/parser.c
       
    14 +++ b/parser.c
       
    15 @@ -4949,7 +4949,8 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
       
    16  		    (ctxt->sax->processingInstruction != NULL))
       
    17  		    ctxt->sax->processingInstruction(ctxt->userData,
       
    18  		                                     target, NULL);
       
    19 -		ctxt->instate = state;
       
    20 +		if (ctxt->instate != XML_PARSER_EOF)
       
    21 +		    ctxt->instate = state;
       
    22  		return;
       
    23  	    }
       
    24  	    buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
       
    25 @@ -5029,7 +5030,8 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
       
    26  	} else {
       
    27  	    xmlFatalErr(ctxt, XML_ERR_PI_NOT_STARTED, NULL);
       
    28  	}
       
    29 -	ctxt->instate = state;
       
    30 +	if (ctxt->instate != XML_PARSER_EOF)
       
    31 +	    ctxt->instate = state;
       
    32      }
       
    33  }
       
    34  
       
    35 @@ -9589,6 +9591,8 @@ xmlParseElement(xmlParserCtxtPtr ctxt) {
       
    36      else
       
    37  	name = xmlParseStartTag(ctxt);
       
    38  #endif /* LIBXML_SAX1_ENABLED */
       
    39 +    if (ctxt->instate == XML_PARSER_EOF)
       
    40 +	return;
       
    41      if (name == NULL) {
       
    42  	spacePop(ctxt);
       
    43          return;
       
    44 @@ -10975,6 +10979,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
       
    45  		else
       
    46  		    name = xmlParseStartTag(ctxt);
       
    47  #endif /* LIBXML_SAX1_ENABLED */
       
    48 +		if (ctxt->instate == XML_PARSER_EOF)
       
    49 +		    goto done;
       
    50  		if (name == NULL) {
       
    51  		    spacePop(ctxt);
       
    52  		    ctxt->instate = XML_PARSER_EOF;
       
    53 @@ -11161,7 +11167,9 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
       
    54  		  else
       
    55  		    xmlParseEndTag1(ctxt, 0);
       
    56  #endif /* LIBXML_SAX1_ENABLED */
       
    57 -		if (ctxt->nameNr == 0) {
       
    58 +		if (ctxt->instate == XML_PARSER_EOF) {
       
    59 +		    /* Nothing */
       
    60 +		} else if (ctxt->nameNr == 0) {
       
    61  		    ctxt->instate = XML_PARSER_EPILOG;
       
    62  		} else {
       
    63  		    ctxt->instate = XML_PARSER_CONTENT;
       
    64 --
       
    65 cgit v0.9.0.2
       
    66