Commit 6e87107
committed
ext/mysqlnd: Fix persistent free of non-persistent connect_attr key.
set_client_option_2d() built the temporary key string with the
connection's persistent flag but always released it with persistent=1.
On a duplicate-key update of the connect_attr hash, zend_hash_update()
does not retain the passed key, so the caller-owned non-persistent
string was freed via free() instead of efree(), tripping the
IS_STR_PERSISTENT assertion in debug builds and mismatching allocators
in release. Reachable by retrying mysqli_real_connect() on a handle
whose first connect failed, since mysqlnd re-adds _client_name and
_server_host on every connect attempt.
close phpGH-219311 parent 7192664 commit 6e87107
3 files changed
Lines changed: 32 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1572 | 1572 | | |
1573 | 1573 | | |
1574 | 1574 | | |
| 1575 | + | |
| 1576 | + | |
1575 | 1577 | | |
1576 | | - | |
1577 | 1578 | | |
1578 | | - | |
1579 | 1579 | | |
1580 | | - | |
1581 | | - | |
1582 | | - | |
1583 | 1580 | | |
1584 | 1581 | | |
1585 | | - | |
| 1582 | + | |
1586 | 1583 | | |
1587 | 1584 | | |
1588 | 1585 | | |
| |||
0 commit comments