tinyxml2
tinyxml2 copied to clipboard
Bad overflow management in QueryUnsignedAttribute
When I try to parse 10 000 000 000 (hex : 2 540B E400) with QueryUnsignedAttribute I get 1 410 065 408 (hex : 540B E400).
I was expecting 4 294 967 295 (hex : FFFF FFFF), max value for uint32_t (unsigned int) or better XML_ERROR.
I think this is really dangerous, no ?
Note : I work on a Linux Lubuntu 64 Bits / G++ compiler.
Thanks for all the work done on this beautiful library.
https://stackoverflow.com/questions/28007600/detecting-integral-overflow-with-scanf Looks like sscanf() yields undefined behavior if the value being parsed cannot fit into the variable.