public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/mariadb-connector-c] f44: Patch CONC-821: 'mysql_stmt_bind_result()' breaks temporal and string type lengths
@ 2026-07-12 9:50 Michal Schorm
0 siblings, 0 replies; only message in thread
From: Michal Schorm @ 2026-07-12 9:50 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/mariadb-connector-c
Branch : f44
Commit : 03b2e1d2171f33529383f462e64fb0c8fe0812db
Author : Michal Schorm <mschorm@redhat.com>
Date : 2026-06-28T14:43:09+02:00
Stats : +60/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/mariadb-connector-c/c/03b2e1d2171f33529383f462e64fb0c8fe0812db?branch=f44
Log:
Patch CONC-821: 'mysql_stmt_bind_result()' breaks temporal and string type lengths
The 3.4.9 rebase included the CONC-812 fix (commit 40806da9) which
replaced the per-type switch in 'mysql_stmt_bind_result()' with a
'pack_len'-based lookup. The new code zeroes '*bind.length' for all
types with negative 'pack_len' — both temporal types
('MYSQL_PS_SKIP_RESULT_W_LEN') and string/blob types
('MYSQL_PS_SKIP_RESULT_STR').
The old switch correctly set temporal types to 'sizeof(MYSQL_TIME)'
and left string/blob types untouched ('default: break'). The new
code zeroes both, breaking any client relying on the documented
'*bind.length' value:
- Qt QMYSQL driver: temporal columns report zero length, producing
invalid QDateTime objects (year 2106, times 00:00:00).
Affects MythTV and other Qt-based database applications.
- Diesel (Rust): string columns report zero length, causing
truncation-based re-fetch to return empty data.
Breaks 'min()'/'max()' queries and migrations.
- Any C-API client checking '*bind.length' per API documentation.
Downstream fix attempt. No upstream fix as of 2026-06-28 — checked
the 3.4 branch (22 commits after v3.4.9, none addressing CONC-821)
and open PRs (none filed). CONC-821 is Open/Major, assigned to
Georg Richter, no fix version set.
Revert safety: the old switch values for numeric types (1, 2, 4, 8)
are identical to the 'pack_len' table values, so no behavior change
for numerics. The 'test_conc812' unit test only checks numeric type
lengths and passes with the reverted switch. The NULL-column path
fix in 'mthd_stmt_fetch_to_bind()' (the actual CONC-812 fix that
preserves length for fixed-size types across NULL rows) branches on
the 'pack_len' lookup table independently and is NOT affected by
this revert. Fixed-size fetch functions ('ps_fetch_int32',
'ps_fetch_double', etc.) do not update '*bind.length' — only
'ps_fetch_bin' (line 1223) and 'ps_fetch_datetime' string-conversion
fallback (line 599) do — so the initial value from 'bind_result'
persists and must be correct.
Reported: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org/thread/3IAHN5U64WGTKZXC3VHEQIAFUG7ACRLL/
Upstream: https://jira.mariadb.org/browse/CONC-821
Related: https://github.com/diesel-rs/diesel/discussions/5091
Co-Authored-By: Claude AI <noreply@anthropic.com>
---
diff --git a/conc-821-fix-bind-result-length.patch b/conc-821-fix-bind-result-length.patch
new file mode 100644
index 0000000..d01cb66
--- /dev/null
+++ b/conc-821-fix-bind-result-length.patch
@@ -0,0 +1,55 @@
+From: Michal Schorm <mschorm@redhat.com>
+Subject: [PATCH] Revert pack_len-based length init in mysql_stmt_bind_result()
+
+Revert the replacement of the per-type switch with a pack_len lookup
+in mysql_stmt_bind_result(), introduced in commit 40806da9.
+
+The pack_len approach zeroes *bind.length for all types with negative
+pack_len, which includes temporal types (MYSQL_PS_SKIP_RESULT_W_LEN)
+and string/blob types (MYSQL_PS_SKIP_RESULT_STR). The old switch
+correctly set temporal types to sizeof(MYSQL_TIME) and left
+string/blob types untouched (default: break).
+
+The zeroing breaks any client relying on the documented *bind.length
+value for temporal or variable-length result columns:
+- Qt QMYSQL driver produces invalid QDateTime (year 2106, time 00:00:00)
+- Diesel (Rust) truncation-based re-fetch returns empty data
+- Any C-API client checking *bind.length per API documentation
+
+The NULL-column path fix in mthd_stmt_fetch_to_bind() (the actual
+CONC-812 fix) is NOT affected by this revert.
+
+Upstream: https://jira.mariadb.org/browse/CONC-821
+Related: https://github.com/diesel-rs/diesel/discussions/5091
+
+---
+ libmariadb/mariadb_stmt.c | 9 ---------
+ 1 file changed, 9 deletions(-)
+
+diff -up a/libmariadb/mariadb_stmt.c b/libmariadb/mariadb_stmt.c
+--- a/libmariadb/mariadb_stmt.c
++++ b/libmariadb/mariadb_stmt.c
+@@ -1438,15 +1438,7 @@
+ if (!stmt->bind[i].error)
+ stmt->bind[i].error= &stmt->bind[i].error_value;
+
+- if (mysql_ps_fetch_functions[stmt->bind[i].buffer_type].pack_len >= 0)
+- {
+- *stmt->bind[i].length= stmt->bind[i].length_value= mysql_ps_fetch_functions[stmt->bind[i].buffer_type].pack_len;
+- } else {
+- *stmt->bind[i].length= stmt->bind[i].length_value= 0;
+- }
+-
+ /* set length values for numeric types */
+-/*
+ switch(bind[i].buffer_type) {
+ case MYSQL_TYPE_NULL:
+ *stmt->bind[i].length= stmt->bind[i].length_value= 0;
+@@ -1476,7 +1468,6 @@
+ default:
+ break;
+ }
+-*/
+ }
+ stmt->bind_result_done= 1;
+ CLEAR_CLIENT_STMT_ERROR(stmt);
diff --git a/mariadb-connector-c.spec b/mariadb-connector-c.spec
index 20f7bdc..00d6df8 100644
--- a/mariadb-connector-c.spec
+++ b/mariadb-connector-c.spec
@@ -15,7 +15,7 @@
Name: mariadb-connector-c
Version: 3.4.9
-Release: 1%{?with_debug:.debug}%{?dist}
+Release: 2%{?with_debug:.debug}%{?dist}
Summary: MariaDB Native Client library (C driver)
License: LGPL-2.1-or-later AND PHP-3.0 AND PHP-3.01 AND LicenseRef-Fedora-Public-Domain
Source0: https://archive.mariadb.org/connector-c-%{version}/%{name}-%{version}-src.tar.gz
@@ -28,6 +28,10 @@ URL: https://mariadb.org/
Patch1: testsuite.patch
%endif
+# Downstream fix attempt for https://jira.mariadb.org/browse/CONC-821
+# No upstream fix as of 2026-06-28 (checked 3.4 branch and PRs)
+Patch2: conc-821-fix-bind-result-length.patch
+
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: libzstd-devel
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-12 9:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-12 9:50 [rpms/mariadb-connector-c] f44: Patch CONC-821: 'mysql_stmt_bind_result()' breaks temporal and string type lengths Michal Schorm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox