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: 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? */ 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--