Skip to content

Commit 338a47b

Browse files
committed
Fix bug #63327
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.
1 parent 5ac55af commit 338a47b

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.1.0beta2
44

5+
- MySQLnd:
6+
. Fixed bug #63327 (Crash (Bus Error) in mysqlnd due to wrong alignment).
7+
(Nikita)
8+
59
- Opcache:
610
. Fixed Bug #81255 (Memory leak in PHPUnit with functional JIT)
711
. Fixed Bug #80959 (infinite loop in building cfg during JIT compilation)

ext/mysqlnd/mysqlnd_alloc.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@ PHPAPI const char * mysqlnd_debug_std_no_trace_funcs[] =
6161
#define __zend_orig_lineno 0
6262
#endif
6363

64-
#define REAL_SIZE(s) (collect_memory_statistics? (s) + sizeof(size_t) : (s))
65-
#define REAL_PTR(p) (collect_memory_statistics && (p)? (((char *)(p)) - sizeof(size_t)) : (p))
66-
#define FAKE_PTR(p) (collect_memory_statistics && (p)? (((char *)(p)) + sizeof(size_t)) : (p))
64+
#define EXTRA_SIZE ZEND_MM_ALIGNED_SIZE(sizeof(size_t))
65+
#define REAL_SIZE(s) (collect_memory_statistics? (s) + EXTRA_SIZE : (s))
66+
#define REAL_PTR(p) (collect_memory_statistics && (p)? (((char *)(p)) - EXTRA_SIZE) : (p))
67+
#define FAKE_PTR(p) (collect_memory_statistics && (p)? (((char *)(p)) + EXTRA_SIZE) : (p))
6768

6869
/* {{{ _mysqlnd_emalloc */
6970
static void * _mysqlnd_emalloc(size_t size MYSQLND_MEM_D)

0 commit comments

Comments
 (0)