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/xpath.c b/xpath.c
index 28d0755..2a7bb32 100644
--- a/xpath.c
+++ b/xpath.c
@@ -3932,16 +3932,19 @@
xmlGenericError(xmlGenericErrorContext, \
"%s:%d Internal error: no context\n", \
__FILE__, __LINE__); \
+ return(NULL); \
} \
else if (ctxt->doc == NULL) { \
xmlGenericError(xmlGenericErrorContext, \
"%s:%d Internal error: no document\n", \
__FILE__, __LINE__); \
+ return(NULL); \
} \
else if (ctxt->doc->children == NULL) { \
xmlGenericError(xmlGenericErrorContext, \
"%s:%d Internal error: document without root\n", \
__FILE__, __LINE__); \
+ return(NULL); \
} \
@@ -10915,7 +10918,7 @@
*/
int
xmlXPathEvalPredicate(xmlXPathContextPtr ctxt, xmlXPathObjectPtr res) {
- if (res == NULL) return(0);
+ if ((ctxt == NULL) || (res == NULL)) return(0);
switch (res->type) {
case XPATH_BOOLEAN:
return(res->boolval);
@@ -10954,7 +10957,7 @@
int
xmlXPathEvaluatePredicateResult(xmlXPathParserContextPtr ctxt,
xmlXPathObjectPtr res) {
- if (res == NULL) return(0);
+ if ((ctxt == NULL) || (res == NULL)) return(0);
switch (res->type) {
case XPATH_BOOLEAN:
return(res->boolval);