1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-25 10:50:08 +03:00

xpath: number('-') should return NaN

Fixes https://gitlab.gnome.org/GNOME/libxslt/-/issues/81
This commit is contained in:
Nick Wellnhofer 2023-01-18 15:15:41 +01:00
parent bbb2b8f136
commit 608c65bb8e
3 changed files with 8 additions and 3 deletions

View File

@ -19,6 +19,10 @@ Object is a number : NaN
Expression: -number('abc')
Object is a number : NaN
========================
Expression: number('-')
Object is a number : NaN
========================
Expression: floor(0.1)
Object is a number : 0

View File

@ -3,6 +3,7 @@ false()
number("1.5")
number('abc')
-number('abc')
number('-')
floor(0.1)
floor(-0.1)
floor(-0)

View File

@ -10001,13 +10001,13 @@ xmlXPathStringEvalNumber(const xmlChar *str) {
#endif
if (cur == NULL) return(0);
while (IS_BLANK_CH(*cur)) cur++;
if ((*cur != '.') && ((*cur < '0') || (*cur > '9')) && (*cur != '-')) {
return(xmlXPathNAN);
}
if (*cur == '-') {
isneg = 1;
cur++;
}
if ((*cur != '.') && ((*cur < '0') || (*cur > '9'))) {
return(xmlXPathNAN);
}
#ifdef __GNUC__
/*