bcheck: fix argument order for memalign

Spotted by George Sedov on the mailing list.

The bug was in the tcc source since >20 years:
https://repo.or.cz/tinycc.git?a=commit;h=ad28d4c5b03da27dc0381afb58f255d49962cca0

manpage for memalign:
https://linux.die.net/man/3/memalign

--
Regards ... Detlef
This commit is contained in:
Detlef Riekenberg 2024-02-15 00:56:54 +01:00 committed by Detlef Riekenberg
parent a7cd016d71
commit f2e8b2ad79

View File

@ -323,7 +323,7 @@ DLL_EXPORT void *__aeabi_memset(void *dst, int c, size_t size);
#define BOUND_REALLOC(a,b) realloc(a,b)
#define BOUND_CALLOC(a,b) calloc(a,b)
DLL_EXPORT void *__bound_malloc(size_t size, const void *caller);
DLL_EXPORT void *__bound_memalign(size_t size, size_t align, const void *caller);
DLL_EXPORT void *__bound_memalign(size_t align, size_t size, const void *caller);
DLL_EXPORT void __bound_free(void *ptr, const void *caller);
DLL_EXPORT void *__bound_realloc(void *ptr, size_t size, const void *caller);
DLL_EXPORT void *__bound_calloc(size_t nmemb, size_t size);
@ -1519,9 +1519,9 @@ void *__bound_malloc(size_t size, const void *caller)
}
#if MALLOC_REDIR
void *memalign(size_t size, size_t align)
void *memalign(size_t align, size_t size)
#else
void *__bound_memalign(size_t size, size_t align, const void *caller)
void *__bound_memalign(size_t align, size_t size, const void *caller)
#endif
{
void *ptr;
@ -1530,7 +1530,7 @@ void *__bound_memalign(size_t size, size_t align, const void *caller)
/* we allocate one more byte to ensure the regions will be
separated by at least one byte. With the glibc malloc, it may
be in fact not necessary */
ptr = BOUND_MEMALIGN(size + 1, align);
ptr = BOUND_MEMALIGN(align, size + 1);
#else
if (align > 4) {
/* XXX: handle it ? */