diff options
author | Detlef Riekenberg <wine.dev@web.de> | 2024-02-15 00:56:54 +0100 |
---|---|---|
committer | Detlef Riekenberg <winspool@users.noreply.github.com> | 2024-02-15 00:56:54 +0100 |
commit | f2e8b2ad792bd6b494f0af19b292bc9670014921 (patch) | |
tree | 0a4cfa86678e71f48b2952a59c2dd8a5a5e8d927 | |
parent | a7cd016d713ce749f707f9e3793f56c13672e791 (diff) |
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
-rw-r--r-- | lib/bcheck.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/bcheck.c b/lib/bcheck.c index 1e374f1..f609a22 100644 --- a/lib/bcheck.c +++ b/lib/bcheck.c @@ -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 ? */ |