Use ZEND_MM_ALIGNED_SIZE for the extra size information.
I don't have a relevant system to test, but this should fix the
issue as long as required alignment is detected correctly.
This commit is contained in:
Nikita Popov 2021-07-23 10:27:31 +02:00
parent 5ac55af5e5
commit 338a47bb85
2 changed files with 8 additions and 3 deletions

4
NEWS
View file

@ -2,6 +2,10 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.1.0beta2
- MySQLnd:
. Fixed bug #63327 (Crash (Bus Error) in mysqlnd due to wrong alignment).
(Nikita)
- Opcache:
. Fixed Bug #81255 (Memory leak in PHPUnit with functional JIT)
. Fixed Bug #80959 (infinite loop in building cfg during JIT compilation)

View file

@ -61,9 +61,10 @@ PHPAPI const char * mysqlnd_debug_std_no_trace_funcs[] =
#define __zend_orig_lineno 0
#endif
#define REAL_SIZE(s) (collect_memory_statistics? (s) + sizeof(size_t) : (s))
#define REAL_PTR(p) (collect_memory_statistics && (p)? (((char *)(p)) - sizeof(size_t)) : (p))
#define FAKE_PTR(p) (collect_memory_statistics && (p)? (((char *)(p)) + sizeof(size_t)) : (p))
#define EXTRA_SIZE ZEND_MM_ALIGNED_SIZE(sizeof(size_t))
#define REAL_SIZE(s) (collect_memory_statistics? (s) + EXTRA_SIZE : (s))
#define REAL_PTR(p) (collect_memory_statistics && (p)? (((char *)(p)) - EXTRA_SIZE) : (p))
#define FAKE_PTR(p) (collect_memory_statistics && (p)? (((char *)(p)) + EXTRA_SIZE) : (p))
/* {{{ _mysqlnd_emalloc */
static void * _mysqlnd_emalloc(size_t size MYSQLND_MEM_D)