[Nasm-bugs] [Bug 3392597] alloc functions: make sure non-NULL returns with zero size parameters.

noreply-nasm at gorcunov.org noreply-nasm at gorcunov.org
Sat Aug 10 03:21:02 PDT 2019


https://bugzilla.nasm.us/show_bug.cgi?id=3392597

Ozkan Sezer <sezeroz at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sezeroz at gmail.com

--- Comment #1 from Ozkan Sezer <sezeroz at gmail.com> ---
> While we are the, fixes the misleading flip in nasm_calloc parameter names.

About that last part:  I suggest changing the nasm_newn macro
like the following, too:
diff --git a/include/nasmlib.h b/include/nasmlib.h
index eb3a637..d8353a7 100644
--- a/include/nasmlib.h
+++ b/include/nasmlib.h
@@ -109,7 +109,7 @@ static inline size_t nasm_last_string_size(void)
 #define nasm_assert_pointer(p) ((void)sizeof(*(p)))

 #define nasm_new(p) ((p) = nasm_zalloc(sizeof(*(p))))
-#define nasm_newn(p,n) ((p) = nasm_calloc(sizeof(*(p)),(n)))
+#define nasm_newn(p,n) ((p) = nasm_calloc((n),sizeof(*(p))))
 /*
  * This is broken on platforms where there are pointers which don't
  * match void * in their internal layout.  It unfortunately also

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.


More information about the Nasm-bugs mailing list