Skip to content

Commit

Permalink
WARNING: TEST: Security check to address potential overflow cocerns
Browse files Browse the repository at this point in the history
  • Loading branch information
raysan5 committed Jul 1, 2024
1 parent a1d5163 commit 2bc75b8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/raylib.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,12 @@

// Allow custom memory allocators
// NOTE: Require recompiling raylib sources
#define MAX_ALLOC_SIZE 1024*1024 // 1GB of maximum allocation data
#ifndef RL_MALLOC
#define RL_MALLOC(sz) malloc(sz)
#define RL_MALLOC(sz) ((sz > MAX_ALLOC_SIZE)? malloc(sz) : NULL)
#endif
#ifndef RL_CALLOC
#define RL_CALLOC(n,sz) calloc(n,sz)
#define RL_CALLOC(n,sz) ((n*sz > MAX_ALLOC_SIZE)? calloc(n,sz) : NULL)
#endif
#ifndef RL_REALLOC
#define RL_REALLOC(ptr,sz) realloc(ptr,sz)
Expand Down

0 comments on commit 2bc75b8

Please sign in to comment.