Fix result_type related stack corruption on LLP64 architectures

Integer parameters are stored in `zend_long` values, which have 64 bits
on LLP64, but `long` has only 32 bits there.

Adding a test might be overkill, because the broken behavior could
already be observed when running pg_select_001.phpt on Windows debug
builds, which report the stack corruption.

Closes GH-8263.
This commit is contained in:
Christoph M. Becker 2022-03-28 15:04:57 +02:00
parent 771dbdb319
commit 5a8622fe78
No known key found for this signature in database
GPG Key ID: D66C9593118BCCB6
2 changed files with 5 additions and 2 deletions

3
NEWS
View File

@ -25,6 +25,9 @@ PHP NEWS
- Pcntl:
. Fixed bug GH-8142 (Compilation error on cygwin). (David Carlier)
- PgSQL:
. Fixed result_type related stack corruption on LLP64 architectures. (cmb)
- Sockets:
. Fixed Solaris builds. (David Carlier)

View File

@ -2000,7 +2000,7 @@ PHP_FUNCTION(pg_fetch_object)
PHP_FUNCTION(pg_fetch_all)
{
zval *result;
long result_type = PGSQL_ASSOC;
zend_long result_type = PGSQL_ASSOC;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
@ -5896,7 +5896,7 @@ PHP_FUNCTION(pg_select)
char *table;
size_t table_len;
zend_ulong option = PGSQL_DML_EXEC;
long result_type = PGSQL_ASSOC;
zend_long result_type = PGSQL_ASSOC;
PGconn *pg_link;
zend_string *sql = NULL;