Skip to content

Commit 5a8622f

Browse files
committed
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.
1 parent 771dbdb commit 5a8622f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ PHP NEWS
2525
- Pcntl:
2626
. Fixed bug GH-8142 (Compilation error on cygwin). (David Carlier)
2727

28+
- PgSQL:
29+
. Fixed result_type related stack corruption on LLP64 architectures. (cmb)
30+
2831
- Sockets:
2932
. Fixed Solaris builds. (David Carlier)
3033

ext/pgsql/pgsql.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2000,7 +2000,7 @@ PHP_FUNCTION(pg_fetch_object)
20002000
PHP_FUNCTION(pg_fetch_all)
20012001
{
20022002
zval *result;
2003-
long result_type = PGSQL_ASSOC;
2003+
zend_long result_type = PGSQL_ASSOC;
20042004
PGresult *pgsql_result;
20052005
pgsql_result_handle *pg_result;
20062006

@@ -5896,7 +5896,7 @@ PHP_FUNCTION(pg_select)
58965896
char *table;
58975897
size_t table_len;
58985898
zend_ulong option = PGSQL_DML_EXEC;
5899-
long result_type = PGSQL_ASSOC;
5899+
zend_long result_type = PGSQL_ASSOC;
59005900
PGconn *pg_link;
59015901
zend_string *sql = NULL;
59025902

0 commit comments

Comments
 (0)