mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-24 01:27:19 +03:00
add a size check when declare a stack array to be less than 2048 bytes
This commit is contained in:
parent
8dc97b1108
commit
48f66cf4a2
4 changed files with 11 additions and 7 deletions
|
|
@ -135,10 +135,14 @@ typedef enum malloc_init_e malloc_init_t;
|
|||
# include <stdlib.h>
|
||||
# endif
|
||||
# endif
|
||||
# define VARIABLE_ARRAY(type, name, count) \
|
||||
# define VARIABLE_ARRAY_UNSAFE(type, name, count) \
|
||||
type *name = alloca(sizeof(type) * (count))
|
||||
#else
|
||||
# define VARIABLE_ARRAY(type, name, count) type name[(count)]
|
||||
# define VARIABLE_ARRAY_UNSAFE(type, name, count) type name[(count)]
|
||||
#endif
|
||||
#define VARIABLE_ARRAY_SIZE_MAX 2048
|
||||
#define VARIABLE_ARRAY(type, name, count) \
|
||||
assert(sizeof(type) * (count) <= VARIABLE_ARRAY_SIZE_MAX); \
|
||||
VARIABLE_ARRAY_UNSAFE(type, name, count)
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_TYPES_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue