diff options
author | Heiko Eißfeldt <heiko@hexco.de> | 2024-12-03 09:47:59 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2024-12-03 09:47:59 +0100 |
commit | 4acab372d31a9fe9184ccc247780940821cda367 (patch) | |
tree | 1a44081e0cc9eece96ef5facd8918cd2b3d07bb1 /libstdc++-v3/include/std | |
parent | be8d1a358e3abc50c14a1d7b1cfee82fe6f6aa3c (diff) | |
download | gcc-4acab372d31a9fe9184ccc247780940821cda367.zip gcc-4acab372d31a9fe9184ccc247780940821cda367.tar.gz gcc-4acab372d31a9fe9184ccc247780940821cda367.tar.bz2 |
replace atoi with strtoul in varasm.cc (decode_reg_name_and_count) [PR114540]
The function uses atoi, which can silently return valid numbers even for
some too large numbers in the string.
Furthermore, the verification that all the characters in asmspec are
decimal digits can be simplified when using strotoul, we can check just
the first digit and whether the end pointer points to '\0'.
2024-12-03 Heiko Eißfeldt <heiko@hexco.de>
PR middle-end/114540
* varasm.cc (decode_reg_name_and_count): Use strtoul instead of atoi
and simplify verification that the whole asmspec contains just decimal
digits.
* gcc.dg/pr114540.c: New test.
Signed-off-by: Heiko Eißfeldt <heiko@hexco.de>
Co-authored-by: Jakub Jelinek <jakub@redhat.com>
Diffstat (limited to 'libstdc++-v3/include/std')
0 files changed, 0 insertions, 0 deletions