From 6096f3e7a585a0e6d203d5324a979b611d97fe21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Thu, 16 Nov 2023 11:14:46 +0000 Subject: [PATCH 1/3] Enable `pdo-firebird` Testing in Nightly --- .github/workflows/nightly.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 224ad8e53f07a..a9fc268b18764 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -48,6 +48,15 @@ jobs: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: test + firebird: + image: jacobalberty/firebird + ports: + - 3050:3050 + env: + ISC_PASSWORD: test + FIREBIRD_DATABASE: test.fdb + FIREBIRD_USER: test + FIREBIRD_PASSWORD: test strategy: fail-fast: false matrix: @@ -287,6 +296,15 @@ jobs: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: test + firebird: + image: jacobalberty/firebird + ports: + - 3050:3050 + env: + ISC_PASSWORD: test + FIREBIRD_DATABASE: test.fdb + FIREBIRD_USER: test + FIREBIRD_PASSWORD: test runs-on: ubuntu-22.04 steps: - name: git checkout @@ -518,6 +536,15 @@ jobs: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: test + firebird: + image: jacobalberty/firebird + ports: + - 3050:3050 + env: + ISC_PASSWORD: test + FIREBIRD_DATABASE: test.fdb + FIREBIRD_USER: test + FIREBIRD_PASSWORD: test strategy: fail-fast: false matrix: From ea0a2a115174cb2be697614a357c09652ce4956f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Fri, 17 Nov 2023 02:52:38 +0000 Subject: [PATCH 2/3] fix(ext/pdo_firebird/tests): dont detect memory leak --- ext/pdo_firebird/tests/bug_47415.phpt | 5 +++-- ext/pdo_firebird/tests/bug_48877.phpt | 5 +++-- ext/pdo_firebird/tests/bug_53280.phpt | 5 +++-- ext/pdo_firebird/tests/bug_62024.phpt | 5 +++-- ext/pdo_firebird/tests/bug_64037.phpt | 5 +++-- ext/pdo_firebird/tests/bug_72583.phpt | 5 +++-- ext/pdo_firebird/tests/bug_72931.phpt | 5 +++-- ext/pdo_firebird/tests/bug_73087.phpt | 5 +++-- ext/pdo_firebird/tests/bug_74462.phpt | 5 +++-- ext/pdo_firebird/tests/bug_76448.phpt | 5 +++-- ext/pdo_firebird/tests/bug_76449.phpt | 5 +++-- ext/pdo_firebird/tests/bug_76450.phpt | 5 +++-- ext/pdo_firebird/tests/bug_76452.phpt | 3 +++ ext/pdo_firebird/tests/bug_76488.phpt | 5 +++-- ext/pdo_firebird/tests/bug_77863.phpt | 5 +++-- ext/pdo_firebird/tests/bug_80521.phpt | 5 +++-- ext/pdo_firebird/tests/bug_aaa.phpt | 5 +++-- ext/pdo_firebird/tests/common.phpt | 1 + ext/pdo_firebird/tests/connect.phpt | 5 +++-- ext/pdo_firebird/tests/ddl.phpt | 5 +++-- ext/pdo_firebird/tests/dialect_1.phpt | 5 +++-- ext/pdo_firebird/tests/execute.phpt | 5 +++-- ext/pdo_firebird/tests/execute_block.phpt | 5 +++-- ext/pdo_firebird/tests/gh10908.phpt | 5 +++-- ext/pdo_firebird/tests/gh8576.phpt | 3 +++ ext/pdo_firebird/tests/ignore_parammarks.phpt | 5 +++-- ext/pdo_firebird/tests/payload_test.phpt | 5 +++-- ext/pdo_firebird/tests/rowCount.phpt | 5 +++-- 28 files changed, 82 insertions(+), 50 deletions(-) diff --git a/ext/pdo_firebird/tests/bug_47415.phpt b/ext/pdo_firebird/tests/bug_47415.phpt index 8349a1d50fe5d..e67a1b3f6da3a 100644 --- a/ext/pdo_firebird/tests/bug_47415.phpt +++ b/ext/pdo_firebird/tests/bug_47415.phpt @@ -4,8 +4,9 @@ Bug #47415 PDO_Firebird segfaults when passing lowercased column name to bindCol pdo_firebird --SKIPIF-- ---ENV-- -LSAN_OPTIONS=detect_leaks=0 +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- ---ENV-- -LSAN_OPTIONS=detect_leaks=0 +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- ---ENV-- -LSAN_OPTIONS=detect_leaks=0 +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- ---ENV-- -LSAN_OPTIONS=detect_leaks=0 +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- ---ENV-- -LSAN_OPTIONS=detect_leaks=0 +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- ---ENV-- -LSAN_OPTIONS=detect_leaks=0 +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- ---ENV-- -LSAN_OPTIONS=detect_leaks=0 +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- ---ENV-- -LSAN_OPTIONS=detect_leaks=0 +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- ---ENV-- -LSAN_OPTIONS=detect_leaks=0 +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- ---ENV-- -LSAN_OPTIONS=detect_leaks=0 +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- ---ENV-- -LSAN_OPTIONS=detect_leaks=0 +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- ---ENV-- -LSAN_OPTIONS=detect_leaks=0 +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- ---ENV-- -LSAN_OPTIONS=detect_leaks=0 +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- ['LSAN_OPTIONS' => 'detect_leaks=0'], 'TESTS' => 'ext/pdo/tests' ); diff --git a/ext/pdo_firebird/tests/connect.phpt b/ext/pdo_firebird/tests/connect.phpt index 0afaf8958f2a9..8b6301d647414 100644 --- a/ext/pdo_firebird/tests/connect.phpt +++ b/ext/pdo_firebird/tests/connect.phpt @@ -4,8 +4,9 @@ PDO_Firebird: connect/disconnect pdo_firebird --SKIPIF-- ---ENV-- -LSAN_OPTIONS=detect_leaks=0 +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- ---ENV-- -LSAN_OPTIONS=detect_leaks=0 +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- ---ENV-- -LSAN_OPTIONS=detect_leaks=0 +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- ---ENV-- -LSAN_OPTIONS=detect_leaks=0 +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- ---ENV-- -LSAN_OPTIONS=detect_leaks=0 +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- ---ENV-- -LSAN_OPTIONS=detect_leaks=0 +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- ---ENV-- -LSAN_OPTIONS=detect_leaks=0 +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- ---ENV-- -LSAN_OPTIONS=detect_leaks=0 +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- Date: Fri, 17 Nov 2023 04:31:45 +0000 Subject: [PATCH 3/3] fix(ext/pdo_firebird): memory alignment error --- ext/pdo_firebird/firebird_statement.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c index 4ad51ab483d96..c8f1154c47f31 100644 --- a/ext/pdo_firebird/firebird_statement.c +++ b/ext/pdo_firebird/firebird_statement.c @@ -51,6 +51,11 @@ static zend_always_inline double get_double_from_sqldata(const ISC_SCHAR *sqldat READ_AND_RETURN_USING_MEMCPY(double, sqldata); } +static zend_always_inline float get_float_from_sqldata(const ISC_SCHAR *sqldata) +{ + READ_AND_RETURN_USING_MEMCPY(float, sqldata); +} + static zend_always_inline ISC_TIMESTAMP get_isc_timestamp_from_sqldata(const ISC_SCHAR *sqldata) { READ_AND_RETURN_USING_MEMCPY(ISC_TIMESTAMP, sqldata); @@ -459,7 +464,7 @@ static int firebird_stmt_get_col( break; case SQL_FLOAT: /* TODO: Why is this not returned as the native type? */ - ZVAL_STR(result, zend_strpprintf(0, "%F", *(float*)var->sqldata)); + ZVAL_STR(result, zend_strpprintf(0, "%F", get_float_from_sqldata(var->sqldata))); break; case SQL_DOUBLE: /* TODO: Why is this not returned as the native type? */