summaryrefslogtreecommitdiff
path: root/Zend/zend_compile.h
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-09-13 22:04:58 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-09-14 00:24:54 +0200
commitee0bf4b24d8f6d1e91e276d1dcdbd7e455c7d597 (patch)
tree9d010cdd589d99fe8091b978cd4da1c20fc0727c /Zend/zend_compile.h
parentec30a3b1716fa33a1769bc45ab01164711c0dfd9 (diff)
downloadphp-git-ee0bf4b24d8f6d1e91e276d1dcdbd7e455c7d597.tar.gz
Define OBJ_PROP_TO_OFFSET() using XtOffsetOf()
This avoids null pointer arithmetic UB.
Diffstat (limited to 'Zend/zend_compile.h')
-rw-r--r--Zend/zend_compile.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index f82507c88c..499d0d64b6 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -373,7 +373,7 @@ typedef struct _zend_property_info {
#define OBJ_PROP_NUM(obj, num) \
(&(obj)->properties_table[(num)])
#define OBJ_PROP_TO_OFFSET(num) \
- ((uint32_t)(zend_uintptr_t)OBJ_PROP_NUM(((zend_object*)NULL), num))
+ ((uint32_t)(XtOffsetOf(zend_object, properties_table) + sizeof(zval) * (num)))
#define OBJ_PROP_TO_NUM(offset) \
((offset - OBJ_PROP_TO_OFFSET(0)) / sizeof(zval))