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/xmlschemastypes.c b/xmlschemastypes.c
index 9346ac6..6dd8cbb 100644
--- a/xmlschemastypes.c
+++ b/xmlschemastypes.c
@@ -470,6 +470,8 @@
int
xmlSchemaIsBuiltInTypeFacet(xmlSchemaTypePtr type, int facetType)
{
+ if (type == NULL)
+ return (-1);
if (type->type != XML_SCHEMA_TYPE_BASIC)
return (-1);
switch (type->builtInType) {
@@ -3789,6 +3791,8 @@
unsigned long actualLen,
unsigned long *expectedLen)
{
+ if (facet == NULL)
+ return(-1);
/*
* TODO: Check if this will work with large numbers.
* (compare value.decimal.mi and value.decimal.hi as well?).
@@ -3844,6 +3848,8 @@
{
unsigned int len = 0;
+ if ((length == NULL) || (facet == NULL) || (type == NULL))
+ return (-1);
*length = 0;
if ((facet->type != XML_SCHEMA_FACET_LENGTH) &&
(facet->type != XML_SCHEMA_FACET_MAXLENGTH) &&
@@ -3918,6 +3924,8 @@
{
int ret;
+ if ((facet == NULL) || (value == NULL))
+ return(-1);
switch (facet->type) {
case XML_SCHEMA_FACET_PATTERN:
ret = xmlRegexpExec(facet->regexp, value);