Skip to content

Commit 8636401

Browse files
committed
Avoid ubsan warning with dummy cache slot addr
1 parent 9277713 commit 8636401

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Zend/zend_compile.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ typedef struct _zend_loop_var {
6262

6363
static inline uint32_t zend_alloc_cache_slots(unsigned count) {
6464
if (count == 0) {
65-
return (uint32_t) -1;
65+
/* Even if no cache slots are desired, the VM handler may still want to acquire
66+
* CACHE_ADDR() unconditionally. Returning zero makes sure that the address
67+
* calculation is still legal and ubsan does not complain. */
68+
return 0;
6669
}
6770

6871
zend_op_array *op_array = CG(active_op_array);

0 commit comments

Comments
 (0)