1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-02-20 13:54:14 +01:00

Fixed mprotect() being called with invalid length values (bug 3642, r=ds).

This commit is contained in:
David Anderson 2009-02-16 15:52:46 -05:00
parent b2b6c22b30
commit ee50d4adfc
2 changed files with 6 additions and 4 deletions

View File

@ -26,6 +26,7 @@
# include <stdio.h>
# include <signal.h>
# include <setjmp.h>
# include <stdint.h>
// http://www.die.net/doc/linux/man/man2/mprotect.2.html
# include <limits.h>
# ifndef PAGESIZE
@ -37,8 +38,8 @@
// We need to align addr down to pagesize on linux
// We assume PAGESIZE is a power of two
# define SH_LALIGN(x) (void*)((intptr_t)(x) & ~(PAGESIZE-1))
# define SH_LALDIF(x) ((intptr_t)(x) & (PAGESIZE-1))
# define SH_LALIGN(x) (void*)((uintptr_t)(x) & ~(PAGESIZE-1))
# define SH_LALDIF(x) ((uintptr_t)(x) & (PAGESIZE-1))
# else
# error Unsupported OS/Compiler
# endif

View File

@ -26,6 +26,7 @@
# include <stdio.h>
# include <signal.h>
# include <setjmp.h>
# include <stdint.h>
// http://www.die.net/doc/linux/man/man2/mprotect.2.html
# include <limits.h>
# ifndef PAGESIZE
@ -37,8 +38,8 @@
// We need to align addr down to pagesize on linux
// We assume PAGESIZE is a power of two
# define SH_LALIGN(x) (void*)((intptr_t)(x) & ~(PAGESIZE-1))
# define SH_LALDIF(x) ((intptr_t)(x) % PAGESIZE)
# define SH_LALIGN(x) (void*)((uintptr_t)(x) & ~(PAGESIZE-1))
# define SH_LALDIF(x) ((uintptr_t)(x) % PAGESIZE)
# else
# error Unsupported OS/Compiler
# endif