]> git.ipfire.org Git - thirdparty/openssl.git/commit
Add overflow checks to parse_number/parse_hex/parse_oct 22795/head
authorNeil Horman <nhorman@openssl.org>
Tue, 28 Nov 2023 18:54:37 +0000 (13:54 -0500)
committerNeil Horman <nhorman@openssl.org>
Thu, 7 Dec 2023 17:07:43 +0000 (12:07 -0500)
commit986c48c4eb26861f25bc68ea252d8f2aad592735
tree82cbc2bb8b6609bff8209b2229a87dfa79ffd9f9
parent504ff2a4ef5f26990a48ca3d664ac1e5d9cb20b9
Add overflow checks to parse_number/parse_hex/parse_oct

Test the next arithmetic operation to safely determine if adding the
next digit in the passed property string will overflow

Also, noted a bug in the parse_hex code.  When parsing non-digit
characters (i.e. a-f and A-F), we do a tolower conversion (which is
fine), and then subtract 'a' to get the hex value from the ascii (which
is definately wrong).  We should subtract 'W' to convert tolower
converted hex digits in the range a-f to their hex value counterparts

Add tests to test_property_parse_error to ensure overflow checks work

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/22874)
crypto/property/property_parse.c
test/property_test.c