• Home
  • Raw
  • Download

Lines Matching +full:pointer +full:- +full:overflow

1 diff --git a/third_party/libopenjpeg20/opj_malloc.h b/third_party/libopenjpeg20/opj_malloc.h
3 --- a/third_party/libopenjpeg20/opj_malloc.h
5 @@ -31,8 +31,6 @@
9 -
10 -#include <stddef.h>
14 @@ -52,7 +50,16 @@ Allocate an uninitialized memory block
16 …@return Returns a void pointer to the allocated space, or NULL if there is insufficient memory ava…
18 -void * opj_malloc(size_t size);
22 +/* prevent assertion on overflow for MSVC */
24 +#define opj_malloc(size) ((size_t)(size) >= (size_t)-0x100 ? NULL : malloc(size))
32 @@ -60,24 +67,98 @@ Allocate a memory block with elements initialized to 0
34 …@return Returns a void pointer to the allocated space, or NULL if there is insufficient memory ava…
36 -void * opj_calloc(size_t numOfElements, size_t sizeOfElements);
40 +/* prevent assertion on overflow for MSVC */
42 +#define opj_calloc(num, size) ((size_t)(num) != 0 && (size_t)(num) >= (size_t)-0x100 / (size_t)(si…
51 …@return Returns a void pointer to the allocated space, or NULL if there is insufficient memory ava…
53 -void * opj_aligned_malloc(size_t size);
54 -void * opj_aligned_realloc(void *ptr, size_t size);
55 -void opj_aligned_free(void* ptr);
80 -/**
81 -Allocate memory aligned to a 32 byte boundary
82 -@param size Bytes to allocate
83 -@return Returns a void pointer to the allocated space, or NULL if there is insufficient memory ava…
84 -*/
85 -void * opj_aligned_32_malloc(size_t size);
86 -void * opj_aligned_32_realloc(void *ptr, size_t size);
142 @@ -85,13 +166,26 @@ Reallocate memory blocks.
144 @return Returns a void pointer to the reallocated (and possibly moved) memory block
146 -void * opj_realloc(void * m, size_t s);
150 +/* prevent assertion on overflow for MSVC */
152 +#define opj_realloc(m, s) ((size_t)(s) >= (size_t)-0x100 ? NULL : realloc(m, s))
162 -void opj_free(void * m);