summaryrefslogtreecommitdiff
path: root/sapi/phpdbg/phpdbg_sigsafe.c
diff options
context:
space:
mode:
authorBob Weinand <bobwei9@hotmail.com>2015-08-21 23:36:31 +0100
committerBob Weinand <bobwei9@hotmail.com>2015-08-21 23:36:31 +0100
commit76e3e99dd674fe98130ba110564c607b12a7772c (patch)
treea41bcd6977d13ff2c5f7638d302dce0203667ee5 /sapi/phpdbg/phpdbg_sigsafe.c
parentf9ae74a4c05584983add5ab68042419d44032b1b (diff)
downloadphp-git-76e3e99dd674fe98130ba110564c607b12a7772c.tar.gz
Fix issues with phpdbg SIGINT handler
Also fix valgrind warnings in allocator when not using mmap()ed memory
Diffstat (limited to 'sapi/phpdbg/phpdbg_sigsafe.c')
-rw-r--r--sapi/phpdbg/phpdbg_sigsafe.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sapi/phpdbg/phpdbg_sigsafe.c b/sapi/phpdbg/phpdbg_sigsafe.c
index 82cb7aba01..54af08ec5b 100644
--- a/sapi/phpdbg/phpdbg_sigsafe.c
+++ b/sapi/phpdbg/phpdbg_sigsafe.c
@@ -8,9 +8,9 @@ ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
static void* zend_mm_mem_alloc(zend_mm_storage *storage, size_t size, size_t alignment) {
- if (EXPECTED(size == PHPDBG_SIGSAFE_MEM_SIZE && !PHPDBG_G(sigsafe_mem).allocated)) {
+ if (EXPECTED(size <= PHPDBG_SIGSAFE_MEM_SIZE && !PHPDBG_G(sigsafe_mem).allocated)) {
PHPDBG_G(sigsafe_mem).allocated = 1;
- return PHPDBG_G(sigsafe_mem).mem;
+ return (void *) (((size_t) PHPDBG_G(sigsafe_mem).mem & ~(alignment - 1)) + alignment);
}
quiet_write(PHPDBG_G(io)[PHPDBG_STDERR].fd, ZEND_STRL("Tried to allocate more than " EXP_STR(PHPDBG_SIGSAFE_MEM_SIZE) " bytes from stack memory in signal handler ... bailing out of signal handler\n"));