diff options
author | Anatol Belski <ab@php.net> | 2018-07-06 16:08:17 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2018-07-06 16:08:17 +0200 |
commit | d85651d58db45fff28fe63570957539afa332ff4 (patch) | |
tree | 587f778944a870feee79ba70372d93a8bcbe2039 /ext/pdo_firebird | |
parent | f3dc67b25553a4d1a32c3705d2cfe06c52d55fa6 (diff) | |
parent | 246cb03e261a8fb499a1cdb70d609a19c26a6574 (diff) | |
download | php-git-d85651d58db45fff28fe63570957539afa332ff4.tar.gz |
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
Fix event log handling in startup phase
Fix bug #76488 Memory leak when fetching a BLOB field
Fix year
Bump version
Diffstat (limited to 'ext/pdo_firebird')
-rw-r--r-- | ext/pdo_firebird/firebird_statement.c | 2 | ||||
-rw-r--r-- | ext/pdo_firebird/tests/bug_76488.phpt | 32 |
2 files changed, 33 insertions, 1 deletions
diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c index bfe2dd717d..46dc10760a 100644 --- a/ext/pdo_firebird/firebird_statement.c +++ b/ext/pdo_firebird/firebird_statement.c @@ -294,7 +294,7 @@ static int firebird_fetch_blob(pdo_stmt_t *stmt, int colno, char **ptr, /* {{{ * unsigned short seg_len; ISC_STATUS stat; - *ptr = S->fetch_buf[colno] = erealloc(*ptr, *len+1); + *ptr = S->fetch_buf[colno] = erealloc(S->fetch_buf[colno], *len+1); for (cur_len = stat = 0; (!stat || stat == isc_segment) && cur_len < *len; cur_len += seg_len) { diff --git a/ext/pdo_firebird/tests/bug_76488.phpt b/ext/pdo_firebird/tests/bug_76488.phpt new file mode 100644 index 0000000000..dba6734c28 --- /dev/null +++ b/ext/pdo_firebird/tests/bug_76488.phpt @@ -0,0 +1,32 @@ +--TEST-- +PDO_Firebird: Bug #76488 Memory leak when fetching a BLOB field +--SKIPIF-- +<?php if (!extension_loaded('interbase') || !extension_loaded('pdo_firebird')) die('skip'); ?> +--FILE-- +<?php +require 'testdb.inc'; +$dbh = new PDO('firebird:dbname='.$test_base, $user, $password) or die; + +$sql = ' +with recursive r(n) as ( + select 1 from rdb$database + union all + select n+1 from r where n < 1000 +) +select n, + cast(lpad(\'A\', 8000, \'A\') as BLOB sub_type TEXT) as SRC +from r +'; + + for ($i = 0; $i < 10; $i++) { + $sth = $dbh->prepare($sql); + $sth->execute(); + $rows = $sth->fetchAll(); + unset($rows); + unset($sth); + } + unset($dbh); + echo "OK"; +?> +--EXPECT-- +OK
\ No newline at end of file |