Re: [xml] int conversion error in xmlSchemaValidateFacet



On Wed, Nov 19, 2003 at 12:31:18PM +0100, rost lo-res org wrote:
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.

  Hum, this sounds a good analysis :-)

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.
[...]
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.

Patches are welcome :-), especially if they come with a good explanation !
But it seems you forgot the attachments :-)

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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