From 76e3e99dd674fe98130ba110564c607b12a7772c Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Fri, 21 Aug 2015 23:36:31 +0100 Subject: Fix issues with phpdbg SIGINT handler Also fix valgrind warnings in allocator when not using mmap()ed memory --- sapi/phpdbg/phpdbg_sigsafe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sapi/phpdbg/phpdbg_sigsafe.c') 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")); -- cgit v1.2.1