GNOME Bugzilla – Bug 300576
xmllint --relaxng fails to report error with date YYYY-MM-DD e.g. 2004-20-09
Last modified: 2017-06-12 19:07:10 UTC
Please describe the problem: Some bad dates are not being reported as an error. Steps to reproduce: [localhost]$ cat date.xml <?xml version="1.0"?> <dates> <!-- valid YYYY-MM-DD --> <date>2004-09-16</date> <date>2004-09</date> <!-- invalid YYYY-MM-DD : bad month : does report an error okay --> <date>2004-16-09</date> <date>2004-16</date> <!-- invalid YYYY-MM-DD : bad month : does *not* report an error!! --> <date>2004-20-09</date> <date>2004-20</date> </dates> [localhost]$ xmllint --noout --relaxng date.rng date.xml Actual results: The date 2004-16-09 is properly reported as an error. However the date 2004-20-09 is *not* reported as an error. Expected results: Both dates should be reported. Does this happen every time? Yes Other information: Doing the same test using Jing rather than xmllint, both errors are properly reported.
Created attachment 45238 [details] gzipped tar includes: date.xml and date.rng
Due to an integer overflow, the number 20 for the month failed to be recognized as invalid. The fields of the _xmlSchemaValDate struct are explicitely limited to the minimum bits needed, thus 20 was enough to overflow. Fixed in CVS for "months", "days", and "minutes" (xmlschemastypes.c rev. 1.89). Thanks for the report!
This should be closed by release of libxml2-2.6.21, thanks, Daniel