diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2017-01-11 04:42:56 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2017-01-11 04:42:56 +0000 |
commit | 64bb5200cf32dde96ed87284f133f735c2a357cd (patch) | |
tree | 3667383e33a713a5467939de0aca2664199ee434 | |
parent | f8689c575165a536353506dd146afe9de5875b1c (diff) | |
download | netpbm-mirror-64bb5200cf32dde96ed87284f133f735c2a357cd.tar.gz netpbm-mirror-64bb5200cf32dde96ed87284f133f735c2a357cd.tar.xz netpbm-mirror-64bb5200cf32dde96ed87284f133f735c2a357cd.zip |
Fix bug: ignores failure of libxml2 function - one cause of failure is running out of memory because of unusual input
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2877 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r-- | converter/other/svgtopam.c | 21 | ||||
-rw-r--r-- | doc/HISTORY | 3 |
2 files changed, 20 insertions, 4 deletions
diff --git a/converter/other/svgtopam.c b/converter/other/svgtopam.c index a10f51da..09e3a24e 100644 --- a/converter/other/svgtopam.c +++ b/converter/other/svgtopam.c @@ -103,16 +103,23 @@ parseCommandLine(int argc, /*============================================================================ Wrappers for libxml2 routines. - The difference is that these use conventional C data types and have - shorter names. + The difference is that these use conventional C data types, have shorter + names, and abort the program instead of returning a special value when they + fail. =============================================================================*/ static const char * getAttribute(xmlTextReaderPtr const xmlReaderP, const char * const attributeName) { - return (const char *) + const char * const rc = (const char *) xmlTextReaderGetAttribute(xmlReaderP, (const xmlChar *)attributeName); + + if (rc == NULL) + pm_error("xmlTextReaderGetAttribute(\"%.256s\") failed. ", + attributeName); + + return rc; } @@ -120,7 +127,13 @@ getAttribute(xmlTextReaderPtr const xmlReaderP, static const char * currentNodeName(xmlTextReaderPtr const xmlReaderP) { - return (const char *)xmlTextReaderConstName(xmlReaderP); + const char * const rc = (const char *) + xmlTextReaderConstName(xmlReaderP); + + if (rc == NULL) + pm_error("xmlTextReaderConstName() failed. "); + + return rc; } diff --git a/doc/HISTORY b/doc/HISTORY index c3c3f293..104a017d 100644 --- a/doc/HISTORY +++ b/doc/HISTORY @@ -6,6 +6,9 @@ CHANGE HISTORY not yet BJH Release 10.78.00 + svgtopam: Fix crash when out of memory. Always broken + (svgtopam was new in Netpbm 10.33 (March 2006)). + pnmcrop: Add -closeness 16.12.25 BJH Release 10.77.00 |