Skip to content

Commit c59219d

Browse files
committed
Perform map ptr base arithmetic through uintptr_t
Adding an offset to the NULL pointer is undefined behavior. Avoid this by performing arithmetic on uintptr_t instead.
1 parent 521c405 commit c59219d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Zend/zend_map_ptr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@
8080
ZEND_MAP_PTR(ptr) = zend_map_ptr_new(); \
8181
} while (0)
8282
# define ZEND_MAP_PTR_REAL_BASE(base) \
83-
((void*)(((char*)(base)) + 1))
83+
((void*)(((uintptr_t)(base)) + 1))
8484
# define ZEND_MAP_PTR_SET_REAL_BASE(base, ptr) do { \
85-
base = (void*)(((char*)(ptr)) - 1); \
85+
base = (void*)(((uintptr_t)(ptr)) - 1); \
8686
} while (0)
8787
#else
8888
# error "Unknown ZEND_MAP_PTR_KIND"

0 commit comments

Comments
 (0)