mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-30 02:24:18 +01:00
Test corner case uses of memory_buffer_alloc.c
This commit is contained in:
parent
9cf1f96a7b
commit
8ec3bfe180
@ -16,3 +16,8 @@ memory_buffer_alloc_free_alloc:100:64:100:100:0:0:0:1:200:0
|
|||||||
Memory buffer alloc - Out of Memory test
|
Memory buffer alloc - Out of Memory test
|
||||||
memory_buffer_alloc_oom_test:
|
memory_buffer_alloc_oom_test:
|
||||||
|
|
||||||
|
Memory buffer small buffer
|
||||||
|
memory_buffer_small_buffer:
|
||||||
|
|
||||||
|
Memory buffer underalloc
|
||||||
|
memory_buffer_underalloc:
|
||||||
|
@ -232,3 +232,31 @@ exit:
|
|||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
|
||||||
|
/* BEGIN_CASE depends_on:MBEDTLS_MEMORY_DEBUG */
|
||||||
|
void memory_buffer_small_buffer( )
|
||||||
|
{
|
||||||
|
unsigned char buf[1];
|
||||||
|
|
||||||
|
mbedtls_memory_buffer_alloc_init( buf, sizeof( buf ) );
|
||||||
|
TEST_ASSERT( mbedtls_memory_buffer_alloc_verify() != 0 );
|
||||||
|
}
|
||||||
|
/* END_CASE */
|
||||||
|
|
||||||
|
/* BEGIN_CASE depends_on:MBEDTLS_MEMORY_DEBUG */
|
||||||
|
void memory_buffer_underalloc( )
|
||||||
|
{
|
||||||
|
unsigned char buf[100];
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
mbedtls_memory_buffer_alloc_init( buf, sizeof( buf ) );
|
||||||
|
for( i = 1; i < MBEDTLS_MEMORY_ALIGN_MULTIPLE; i++ )
|
||||||
|
{
|
||||||
|
TEST_ASSERT( mbedtls_calloc( 1,
|
||||||
|
(size_t)-( MBEDTLS_MEMORY_ALIGN_MULTIPLE - i ) ) == NULL );
|
||||||
|
TEST_ASSERT( mbedtls_memory_buffer_alloc_verify() == 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
|
mbedtls_memory_buffer_alloc_free();
|
||||||
|
}
|
||||||
|
/* END_CASE */
|
||||||
|
Loading…
Reference in New Issue
Block a user