autogenerate a minimal NULL value sequence for unknown pointer types This
* gentest.py testapi.c: autogenerate a minimal NULL value sequence
for unknown pointer types
* HTMLparser.c SAX2.c chvalid.c encoding.c entities.c parser.c
parserInternals.c relaxng.c valid.c xmlIO.c xmlreader.c
xmlsave.c xmlschemas.c xmlschemastypes.c xmlstring.c xpath.c
xpointer.c: This uncovered an impressive amount of entry points
not checking for NULL pointers when they ought to, closing all
the open gaps.
Daniel
diff --git a/valid.c b/valid.c
index 9fa6c14..685ce6f 100644
--- a/valid.c
+++ b/valid.c
@@ -1517,6 +1517,8 @@
*/
void
xmlDumpElementDecl(xmlBufferPtr buf, xmlElementPtr elem) {
+ if ((buf == NULL) || (elem == NULL))
+ return;
switch (elem->etype) {
case XML_ELEMENT_TYPE_EMPTY:
xmlBufferWriteChar(buf, "<!ELEMENT ");
@@ -1587,6 +1589,8 @@
*/
void
xmlDumpElementTable(xmlBufferPtr buf, xmlElementTablePtr table) {
+ if ((buf == NULL) || (table == NULL))
+ return;
xmlHashScan(table, (xmlHashScanner) xmlDumpElementDeclScan, buf);
}
#endif /* LIBXML_OUTPUT_ENABLED */
@@ -1666,7 +1670,8 @@
*/
static void
xmlDumpEnumeration(xmlBufferPtr buf, xmlEnumerationPtr cur) {
- if (cur == NULL) return;
+ if ((buf == NULL) || (cur == NULL))
+ return;
xmlBufferWriteCHAR(buf, cur->name);
if (cur->next == NULL)
@@ -2073,6 +2078,8 @@
*/
void
xmlDumpAttributeDecl(xmlBufferPtr buf, xmlAttributePtr attr) {
+ if ((buf == NULL) || (attr == NULL))
+ return;
xmlBufferWriteChar(buf, "<!ATTLIST ");
xmlBufferWriteCHAR(buf, attr->elem);
xmlBufferWriteChar(buf, " ");
@@ -2164,6 +2171,8 @@
*/
void
xmlDumpAttributeTable(xmlBufferPtr buf, xmlAttributeTablePtr table) {
+ if ((buf == NULL) || (table == NULL))
+ return;
xmlHashScan(table, (xmlHashScanner) xmlDumpAttributeDeclScan, buf);
}
#endif /* LIBXML_OUTPUT_ENABLED */
@@ -2347,6 +2356,8 @@
*/
void
xmlDumpNotationDecl(xmlBufferPtr buf, xmlNotationPtr nota) {
+ if ((buf == NULL) || (nota == NULL))
+ return;
xmlBufferWriteChar(buf, "<!NOTATION ");
xmlBufferWriteCHAR(buf, nota->name);
if (nota->PublicID != NULL) {
@@ -2384,6 +2395,8 @@
*/
void
xmlDumpNotationTable(xmlBufferPtr buf, xmlNotationTablePtr table) {
+ if ((buf == NULL) || (table == NULL))
+ return;
xmlHashScan(table, (xmlHashScanner) xmlDumpNotationDeclScan, buf);
}
#endif /* LIBXML_OUTPUT_ENABLED */