mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 22:45:48 +01:00
Prevent false positive CF Test Failures
Marked dirty memory ends up in the result buffer after encoding (due to the input having been marked dirty), and then the final comparison to make sure that we got what we expected was triggering the constant flow checker. Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
parent
7dac825a3c
commit
4c71707987
@ -25,6 +25,10 @@ void mbedtls_base64_encode( char * src_string, char * dst_string,
|
|||||||
TEST_ASSERT( mbedtls_base64_encode( dst_str, dst_buf_size, &len, src_str, src_len) == result );
|
TEST_ASSERT( mbedtls_base64_encode( dst_str, dst_buf_size, &len, src_str, src_len) == result );
|
||||||
TEST_CF_PUBLIC( src_str, sizeof( src_str ) );
|
TEST_CF_PUBLIC( src_str, sizeof( src_str ) );
|
||||||
|
|
||||||
|
/* dest_str will have had tainted data copied to it, prevent the TEST_ASSERT below from triggering
|
||||||
|
CF failures by unmarking it. */
|
||||||
|
TEST_CF_PUBLIC( dst_str, len );
|
||||||
|
|
||||||
if( result == 0 )
|
if( result == 0 )
|
||||||
{
|
{
|
||||||
TEST_ASSERT( strcmp( (char *) dst_str, dst_string ) == 0 );
|
TEST_ASSERT( strcmp( (char *) dst_str, dst_string ) == 0 );
|
||||||
@ -66,6 +70,10 @@ void base64_encode_hex( data_t * src, char * dst, int dst_buf_size,
|
|||||||
TEST_ASSERT( mbedtls_base64_encode( res, dst_buf_size, &len, src->x, src->len ) == result );
|
TEST_ASSERT( mbedtls_base64_encode( res, dst_buf_size, &len, src->x, src->len ) == result );
|
||||||
TEST_CF_PUBLIC( src->x, src->len );
|
TEST_CF_PUBLIC( src->x, src->len );
|
||||||
|
|
||||||
|
/* res will have had tainted data copied to it, prevent the TEST_ASSERT below from triggering
|
||||||
|
CF failures by unmarking it. */
|
||||||
|
TEST_CF_PUBLIC( res, len );
|
||||||
|
|
||||||
if( result == 0 )
|
if( result == 0 )
|
||||||
{
|
{
|
||||||
TEST_ASSERT( len == strlen( dst ) );
|
TEST_ASSERT( len == strlen( dst ) );
|
||||||
|
Loading…
Reference in New Issue
Block a user