mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-05-19 11:26:26 +03:00
Fix dangerous casts in tests.
Fix dangerous casts of int variables to pointers in thread join function calls. On LP64 systems, int and pointers are different sizes, so writes can corrupt memory.
This commit is contained in:
parent
dda90f59e2
commit
8edaf86b67
3 changed files with 10 additions and 6 deletions
|
|
@ -104,12 +104,12 @@ main(void)
|
|||
je_thread_start(NULL);
|
||||
|
||||
je_thread_create(&thread, je_thread_start, NULL);
|
||||
je_thread_join(thread, (void *)&ret);
|
||||
je_thread_join(thread, NULL);
|
||||
|
||||
je_thread_start(NULL);
|
||||
|
||||
je_thread_create(&thread, je_thread_start, NULL);
|
||||
je_thread_join(thread, (void *)&ret);
|
||||
je_thread_join(thread, NULL);
|
||||
|
||||
je_thread_start(NULL);
|
||||
|
||||
|
|
|
|||
|
|
@ -72,8 +72,12 @@ main(void)
|
|||
(void *)&arena_ind);
|
||||
}
|
||||
|
||||
for (i = 0; i < NTHREADS; i++)
|
||||
je_thread_join(threads[i], (void *)&ret);
|
||||
for (i = 0; i < NTHREADS; i++) {
|
||||
intptr_t join_ret;
|
||||
je_thread_join(threads[i], (void *)&join_ret);
|
||||
if (join_ret != 0)
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
label_return:
|
||||
malloc_printf("Test end\n");
|
||||
|
|
|
|||
|
|
@ -77,12 +77,12 @@ main(void)
|
|||
je_thread_start(NULL);
|
||||
|
||||
je_thread_create(&thread, je_thread_start, NULL);
|
||||
je_thread_join(thread, (void *)&ret);
|
||||
je_thread_join(thread, NULL);
|
||||
|
||||
je_thread_start(NULL);
|
||||
|
||||
je_thread_create(&thread, je_thread_start, NULL);
|
||||
je_thread_join(thread, (void *)&ret);
|
||||
je_thread_join(thread, NULL);
|
||||
|
||||
je_thread_start(NULL);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue