mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-30 00:44:20 +01:00
Fix warning with gcc7/maximum allocation exceeded
Adds an additional boundary check to the test parameter bytes_arg in generate_random() in test_suite_psa_crypto.function. This is to check against a possible underflow, and to avoid a warning, "argument ... exceeds maximum object size", (-Werror=alloc-size-larger-than) that GCC 7 generates. Signed-off-by: Simon Butcher <simon.butcher@arm.com>
This commit is contained in:
parent
cf4a40ba0a
commit
49f8e3157c
@ -5297,6 +5297,8 @@ void generate_random( int bytes_arg )
|
|||||||
size_t i;
|
size_t i;
|
||||||
unsigned run;
|
unsigned run;
|
||||||
|
|
||||||
|
TEST_ASSERT( bytes_arg >= 0 );
|
||||||
|
|
||||||
ASSERT_ALLOC( output, bytes + sizeof( trail ) );
|
ASSERT_ALLOC( output, bytes + sizeof( trail ) );
|
||||||
ASSERT_ALLOC( changed, bytes );
|
ASSERT_ALLOC( changed, bytes );
|
||||||
memcpy( output + bytes, trail, sizeof( trail ) );
|
memcpy( output + bytes, trail, sizeof( trail ) );
|
||||||
|
Loading…
Reference in New Issue
Block a user