[xml] int conversion error in xmlSchemaValidateFacet



Hi,

I encountered a bug when validating an element containing an optional
string with a maxlength-facet set. The problem seems to be that
xmlUTF8StrLen returns a signed int which is -1 in case the pointer to
string is NULL (which is the case if the optional string is empty).
However, in xmlSchemaValidateFacet the variable (len) containing the
length of the string is an unsigned int so the -1 gets implicitely
converted to 4294967295.

Any comments ? I have included an example and a really small patch as an
attachement which should fix the problem. I didn't want to patch
xmlUTF8Strlen since this might do more harm to other routines.

cu,
Robert

BTW: I didn't know if sending patches to the list is welcome. In case
there is another procedere please let me know so I don't spoil the list
with unwanted posts.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]