bind9/lib/isc/tests
Ondřej Surý 4cdb3abf27 Return non-NULL pointer on zero-sized allocations and reallocations
Previously, the zero-sized allocations would return NULL pointer and the
caller had to make sure to not dereference such pointer.  The C standard
defines the zero-sized calls to malloc() as implementation specific and
jemalloc mallocx() with zero size would be undefined behaviour.  This
complicated the code as it had to handle such cases in a special manner
in all allocator and deallocator functions.

Now, for realloc(), the situation is even more complicated.  In C
standard up to C11, the behavior would be implementation defined, and
actually some implementation would free to orig ptr and some would not.
Since C17 (via DR400) would deprecate such usage and since C23, the
behaviour would be undefined.

This commits changes helper mem_get(), mem_put() and mem_realloc()
functions to grow the zero-allocation from 0 to sizeof(void *).

This way we get a predicable behaviour that all the allocations will
always return valid pointer.
2021-09-23 22:17:15 +02:00
..
testdata/file [master] new mkeys and nzf naming format 2014-11-04 19:43:27 -08:00
aes_test.c The isc/platform.h header has been completely removed 2021-07-06 05:33:48 +00:00
buffer_test.c Record skipped unit test as skipped in Automake framework 2021-02-15 11:18:03 +01:00
counter_test.c Record skipped unit test as skipped in Automake framework 2021-02-15 11:18:03 +01:00
crc64_test.c Record skipped unit test as skipped in Automake framework 2021-02-15 11:18:03 +01:00
doh_test.c Replace multiple /dns-query constants with a global one 2021-08-30 10:32:17 +03:00
errno_test.c Record skipped unit test as skipped in Automake framework 2021-02-15 11:18:03 +01:00
file_test.c Record skipped unit test as skipped in Automake framework 2021-02-15 11:18:03 +01:00
hash_test.c Remove native PKCS#11 support 2021-09-09 15:35:39 +02:00
heap_test.c Record skipped unit test as skipped in Automake framework 2021-02-15 11:18:03 +01:00
hmac_test.c Record skipped unit test as skipped in Automake framework 2021-02-15 11:18:03 +01:00
ht_test.c Record skipped unit test as skipped in Automake framework 2021-02-15 11:18:03 +01:00
isctest.c ensure interlocked netmgr events run on worker[0] 2021-05-07 14:28:32 -07:00
isctest.h update all copyright headers to eliminate the typo 2020-09-14 16:20:40 -07:00
lex_test.c Use %d for enum values 2021-08-19 10:19:32 +10:00
Makefile.am Add stats unit test 2021-08-24 09:07:15 +02:00
md_test.c Record skipped unit test as skipped in Automake framework 2021-02-15 11:18:03 +01:00
mem_test.c Return non-NULL pointer on zero-sized allocations and reallocations 2021-09-23 22:17:15 +02:00
netaddr_test.c Record skipped unit test as skipped in Automake framework 2021-02-15 11:18:03 +01:00
netmgr_test.c Make the DNS over HTTPS support optional 2021-07-07 09:50:53 +02:00
parse_test.c Record skipped unit test as skipped in Automake framework 2021-02-15 11:18:03 +01:00
pool_test.c Record skipped unit test as skipped in Automake framework 2021-02-15 11:18:03 +01:00
quota_test.c Add nanosleep and usleep Windows shims 2021-05-03 20:22:54 +02:00
radix_test.c Record skipped unit test as skipped in Automake framework 2021-02-15 11:18:03 +01:00
random_test.c Record skipped unit test as skipped in Automake framework 2021-02-15 11:18:03 +01:00
regex_test.c Record skipped unit test as skipped in Automake framework 2021-02-15 11:18:03 +01:00
result_test.c Remove native PKCS#11 support 2021-09-09 15:35:39 +02:00
safe_test.c Record skipped unit test as skipped in Automake framework 2021-02-15 11:18:03 +01:00
siphash_test.c Record skipped unit test as skipped in Automake framework 2021-02-15 11:18:03 +01:00
sockaddr_test.c Record skipped unit test as skipped in Automake framework 2021-02-15 11:18:03 +01:00
socket_test.c The isc/platform.h header has been completely removed 2021-07-06 05:33:48 +00:00
stats_test.c Add a function isc_stats_resize 2021-08-24 09:07:15 +02:00
symtab_test.c Record skipped unit test as skipped in Automake framework 2021-02-15 11:18:03 +01:00
task_test.c The isc/platform.h header has been completely removed 2021-07-06 05:33:48 +00:00
taskpool_test.c only run tasks as privileged if taskmgr is in privileged mode 2021-05-07 14:28:30 -07:00
time_test.c Add isc_time_now_hires function to get current time with high resolution 2021-03-20 11:25:55 -07:00
timer_test.c Reset errcnt at the start of each subtest 2021-07-12 03:47:11 +00:00
uv_wrap.h Cleanup the remaining of HAVE_UV_<func> macros 2021-06-02 11:23:36 +02:00