Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integer/floating point parsing should validate content and/or value range #15

Open
zeux opened this issue Oct 26, 2014 · 2 comments
Open

Comments

@zeux
Copy link
Owner

zeux commented Oct 26, 2014

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".

@zeux
Copy link
Owner Author

zeux commented Dec 14, 2014

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.

@zeux
Copy link
Owner Author

zeux commented Oct 19, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant