Add overflow checking to array (#111)

This commit is contained in:
Bailey Thompson
2020-08-17 02:49:10 -04:00
committed by GitHub
parent 044a853994
commit a6225f9571
2 changed files with 11 additions and 2 deletions

View File

@@ -5,6 +5,10 @@
static void test_invalid_init(void)
{
assert(!array_init(1, 0));
/* These tests rely on this. */
assert(sizeof(size_t) == sizeof(unsigned long));
assert(!array_init(ULONG_MAX, ULONG_MAX));
assert(!array_init(1, ULONG_MAX));
}
static void test_empty_array(void)