pidgin: 34f4897e: xmlCtxtGetLastError may return NULL, esp...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sat Apr 25 21:50:39 EDT 2009


-----------------------------------------------------------------
Revision: 34f4897e97207306dbf82089892390d2c2d34847
Ancestor: ca9f6d5b44c825689a68f91153d542205a39adf5
Author: darkrain42 at pidgin.im
Date: 2009-04-26T01:42:34
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/34f4897e97207306dbf82089892390d2c2d34847

Modified files:
        libpurple/protocols/jabber/parser.c

ChangeLog: 

xmlCtxtGetLastError may return NULL, especially with other misbehaving
libraries in our address space.

References #8136.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/parser.c	1d02d69d0ec9be3e0e0c53d3321660bc38b2c914
+++ libpurple/protocols/jabber/parser.c	9fd9ce48dbd4dfe18dd056690a173f27399445ba
@@ -232,8 +232,17 @@ void jabber_parser_process(JabberStream 
 		xmlParseChunk(js->context, "", 0, 0);
 	} else if ((ret = xmlParseChunk(js->context, buf, len, 0)) != XML_ERR_OK) {
 		xmlError *err = xmlCtxtGetLastError(js->context);
+		/*
+		 * libxml2 uses a global setting to determine whether or not to store
+		 * warnings.  Other libraries may set this, which causes err to be
+		 * NULL. See #8136 for details.
+		 */
+		xmlErrorLevel level = XML_ERR_WARNING;
 
-		switch (err->level) {
+		if (err)
+			level = err->level;
+
+		switch (level) {
 			case XML_ERR_NONE:
 				purple_debug_info("jabber", "xmlParseChunk returned info %i\n", ret);
 				break;


More information about the Commits mailing list