Hash :
4bebb030
Author :
Date :
2016-04-21T13:41:09
Rework XPath rounding functions Use the C library's floor and ceil functions. The old code was overly complicated for no apparent reason and could result in undefined behavior when handling NaNs (found with afl-fuzz and UBSan). Fix wrong comment in xmlXPathRoundFunction. The implementation was already following the spec and rounding half up.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
true()
false()
number("1.5")
number('abc')
-number('abc')
floor(0.1)
floor(-0.1)
floor(-0)
floor(0)
floor(5.2)
floor(-5.2)
floor(100000000000000000000)
floor(-100000000000000000000)
floor(0 div 0)
floor(1 div 0)
floor(-1 div 0)
ceiling(0.1)
ceiling(-0.1)
ceiling(-0)
ceiling(0)
ceiling(5.2)
ceiling(-5.2)
ceiling(100000000000000000000)
ceiling(-100000000000000000000)
ceiling(0 div 0)
ceiling(1 div 0)
ceiling(-1 div 0)
round(0.1)
round(5.2)
round(5.5)
round(5.6)
round(-0.1)
round(-5.2)
round(-5.5)
round(-5.6)
round(0.5)
round(-0.5)
round(100000000000000000000)
round(-100000000000000000000)
round(0 div 0)
round(1 div 0)
round(-1 div 0)