From 11ec6aefd14de1cb7625f5df7114a096e27c4d13 Mon Sep 17 00:00:00 2001 From: Rhodri James Date: Tue, 25 Apr 2017 18:37:37 +0100 Subject: [PATCH] Validate parser parameter to XML_GetCurrentColumnNumber --- expat/lib/expat.h | 3 ++- expat/lib/xmlparse.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/expat/lib/expat.h b/expat/lib/expat.h index 479b6784..ff83ff11 100644 --- a/expat/lib/expat.h +++ b/expat/lib/expat.h @@ -943,7 +943,8 @@ XML_GetErrorCode(XML_Parser parser); was detected; otherwise the location is the location of the last parse event, as described above. - Note: XML_GetCurrentLineNumber returns 0 to indicate an error + Note: XML_GetCurrentLineNumber and XML_GetCurrentColumnNumber + return 0 to indicate an error. Note: XML_GetCurrentByteIndex returns -1 to indicate an error. */ XMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser); diff --git a/expat/lib/xmlparse.c b/expat/lib/xmlparse.c index ae9eb1ce..9b2b6fa6 100644 --- a/expat/lib/xmlparse.c +++ b/expat/lib/xmlparse.c @@ -2071,6 +2071,8 @@ XML_GetCurrentLineNumber(XML_Parser parser) XML_Size XMLCALL XML_GetCurrentColumnNumber(XML_Parser parser) { + if (parser == NULL) + return 0; if (eventPtr && eventPtr >= positionPtr) { XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); positionPtr = eventPtr;