1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-26 00:37:43 +03:00

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.
This commit is contained in:
Nick Wellnhofer
2016-04-21 13:41:09 +02:00
parent 43f50f4dfc
commit 4bebb030db
3 changed files with 100 additions and 56 deletions

View File

@@ -9,12 +9,22 @@ 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)
@@ -23,3 +33,10 @@ 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)