pugixml
pugixml copied to clipboard
Integer/floating point parsing should validate content and/or value range
This issue was filed on Google Code: https://code.google.com/p/pugixml/issues/detail?id=237
There are concerns about using errno on some platforms; even on platforms that have MT-safe errno, parsing denormal numbers will set errno to ERANGE but keep the parsed output as far as I know.
Checking the end pointer can potentially be a breaking change if applications relied on parsing numbers like "1.2f".
Additional note: for parsing unsigned integers, ERANGE will not be set for negative numbers when using strtoul/strtoull - so we'll have to check whether there is a whitespace + minus sequence and flag this as invalid.
New integer parsing implementation handles overflow/underflow correctly for all cases. It still uses the legacy way of clamping the result without indicating an error, but at least for integers it's now easy to implement full validation - the open question being the specific interface.