Validate parser parameter to XML_GetCurrentColumnNumber

This commit is contained in:
Rhodri James 2017-04-25 18:37:37 +01:00 committed by Sebastian Pipping
parent 1bf78fe1fb
commit 11ec6aefd1
2 changed files with 4 additions and 1 deletions

View File

@ -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);

View File

@ -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;