Skip to content

Commit e81cfc6

Browse files
committed
More poisoning
1 parent 456fc1f commit e81cfc6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Zend/zend_alloc.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2769,12 +2769,15 @@ ZEND_API bool is_zend_ptr(const void *ptr)
27692769
#if ZEND_MM_CUSTOM
27702770
# define ZEND_MM_CUSTOM_ALLOCATOR(size) do { \
27712771
if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) { \
2772-
return AG(mm_heap)->custom_heap._malloc(size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); \
2772+
void *ret = AG(mm_heap)->custom_heap._malloc(size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); \
2773+
ZEND_ASAN_POISON_MEMORY_REGION(AG(mm_heap), sizeof(zend_mm_heap)); \
2774+
return ret; \
27732775
} \
27742776
} while (0)
27752777
# define ZEND_MM_CUSTOM_DEALLOCATOR(ptr) do { \
27762778
if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) { \
27772779
AG(mm_heap)->custom_heap._free(ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); \
2780+
ZEND_ASAN_POISON_MEMORY_REGION(AG(mm_heap), sizeof(zend_mm_heap)); \
27782781
return; \
27792782
} \
27802783
} while (0)
@@ -2785,11 +2788,11 @@ ZEND_API bool is_zend_ptr(const void *ptr)
27852788

27862789
# define _ZEND_BIN_ALLOCATOR(_num, _size, _elements, _pages, _min_size, y) \
27872790
ZEND_API void* ZEND_FASTCALL _emalloc_ ## _size(void) { \
2791+
ZEND_ASAN_UNPOISON_MEMORY_REGION(AG(mm_heap), sizeof(zend_mm_heap)); \
27882792
ZEND_MM_CUSTOM_ALLOCATOR(_size); \
27892793
if (_size < _min_size) { \
27902794
return _emalloc_ ## _min_size(); \
27912795
} \
2792-
ZEND_ASAN_UNPOISON_MEMORY_REGION(AG(mm_heap), sizeof(zend_mm_heap)); \
27932796
void *ptr = zend_mm_alloc_small(AG(mm_heap), _num ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); \
27942797
ZEND_ASAN_POISON_MEMORY_REGION(AG(mm_heap), sizeof(zend_mm_heap)); \
27952798
ZEND_ASAN_UNPOISON_MEMORY_REGION(ptr, _size); \

0 commit comments

Comments
 (0)