mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-23 20:15:19 -07:00
Add extra assert() in tests allocating memory on the heap.
This commit is contained in:
parent
6189eec330
commit
d556a56c3c
@ -267,8 +267,10 @@ static void tv3(void)
|
||||
|
||||
do {
|
||||
out = (char *) sodium_malloc(strlen(tests[i].out) + 1U);
|
||||
assert(out != NULL);
|
||||
memcpy(out, tests[i].out, strlen(tests[i].out) + 1U);
|
||||
passwd = (char *) sodium_malloc(strlen(tests[i].passwd) + 1U);
|
||||
assert(passwd != NULL);
|
||||
memcpy(passwd, tests[i].passwd, strlen(tests[i].passwd) + 1U);
|
||||
if (crypto_pwhash_scryptsalsa208sha256_str_verify(
|
||||
out, passwd, strlen(passwd)) != 0) {
|
||||
|
@ -48,6 +48,7 @@ int main(void)
|
||||
for (i = 0U; i < 10000U; i++) {
|
||||
size = randombytes_uniform(100000U);
|
||||
buf = sodium_malloc(size);
|
||||
assert(buf != NULL);
|
||||
memset(buf, i, size);
|
||||
sodium_mprotect_readonly(buf);
|
||||
sodium_free(buf);
|
||||
@ -65,6 +66,7 @@ int main(void)
|
||||
#endif
|
||||
size = randombytes_uniform(100000U);
|
||||
buf = sodium_malloc(size);
|
||||
assert(buf != NULL);
|
||||
sodium_mprotect_readonly(buf);
|
||||
sodium_mprotect_readwrite(buf);
|
||||
#ifndef __EMSCRIPTEN__
|
||||
|
@ -43,6 +43,7 @@ int main(void)
|
||||
#endif
|
||||
size = randombytes_uniform(100000U);
|
||||
buf = sodium_malloc(size);
|
||||
assert(buf != NULL);
|
||||
sodium_mprotect_noaccess(buf);
|
||||
sodium_mprotect_readwrite(buf);
|
||||
#ifndef __EMSCRIPTEN__
|
||||
|
Loading…
Reference in New Issue
Block a user