Fix out-of-bounds stack write (GCC 14 compatibility)

Related to:

  <https://fedoraproject.org/wiki/Changes/PortingToModernC>
  <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
This commit is contained in:
Florian Weimer 2024-01-29 08:36:29 +01:00
parent 1dad4482e8
commit 7f199a018e
2 changed files with 47 additions and 1 deletions

41
unixODBC-c89.patch Normal file
View File

@ -0,0 +1,41 @@
PostgreSQL driver: Fix incompatible pointer-to-integer types
These result in out-of-bounds stack writes on 64-bit architectures
(caller has 4 bytes, callee writes 8 bytes), and seem to have gone
unnoticed on little-endian architectures (although big-endian
architectures must be broken).
This change is required to avoid a build failure with GCC 14.
Submitted upstream: <https://github.com/lurcher/unixODBC/pull/157>
diff --git a/Drivers/Postgre7.1/info.c b/Drivers/Postgre7.1/info.c
index 63ac91f3f359f6ba..2216ecd4892e4efd 100644
--- a/Drivers/Postgre7.1/info.c
+++ b/Drivers/Postgre7.1/info.c
@@ -1779,14 +1779,14 @@ char *table_name;
char index_name[MAX_INFO_STRING];
short fields_vector[8];
char isunique[10], isclustered[10];
-SDWORD index_name_len, fields_vector_len;
+SQLLEN index_name_len, fields_vector_len;
TupleNode *row;
int i;
HSTMT hcol_stmt;
StatementClass *col_stmt, *indx_stmt;
char column_name[MAX_INFO_STRING], relhasrules[MAX_INFO_STRING];
char **column_names = 0;
-Int4 column_name_len;
+SQLLEN column_name_len;
int total_columns = 0;
char error = TRUE;
ConnInfo *ci;
@@ -2136,7 +2136,7 @@ HSTMT htbl_stmt;
StatementClass *tbl_stmt;
char tables_query[STD_STATEMENT_LEN];
char attname[MAX_INFO_STRING];
-SDWORD attname_len;
+SQLLEN attname_len;
char pktab[MAX_TABLE_LEN + 1];
Int2 result_cols;

View File

@ -1,7 +1,7 @@
Summary: A complete ODBC driver manager for Linux Summary: A complete ODBC driver manager for Linux
Name: unixODBC Name: unixODBC
Version: 2.3.12 Version: 2.3.12
Release: 3%{?dist} Release: 4%{?dist}
URL: http://www.unixODBC.org/ URL: http://www.unixODBC.org/
# See README: Programs are GPL, libraries are LGPL # See README: Programs are GPL, libraries are LGPL
# News Server library (Drivers/nn/yyparse.c) is GPLv3+ # News Server library (Drivers/nn/yyparse.c) is GPLv3+
@ -14,6 +14,7 @@ Source5: README.dist
Patch8: so-version-bump.patch Patch8: so-version-bump.patch
Patch9: keep-typedefs.patch Patch9: keep-typedefs.patch
Patch10: unixODBC-c89.patch
Conflicts: iodbc Conflicts: iodbc
@ -40,6 +41,7 @@ ODBC, you need to install this package.
%setup -q %setup -q
%patch -P8 -p1 -b .soname-bump %patch -P8 -p1 -b .soname-bump
%patch -P9 -p1 %patch -P9 -p1
%patch -P 10 -p1
chmod 0644 Drivers/MiniSQL/*.c chmod 0644 Drivers/MiniSQL/*.c
chmod 0644 Drivers/nn/*.c chmod 0644 Drivers/nn/*.c
@ -117,6 +119,9 @@ find $RPM_BUILD_ROOT%{_libdir} -name "*.so" | sed "s|^$RPM_BUILD_ROOT||" > dev
%_libdir/pkgconfig/*.pc %_libdir/pkgconfig/*.pc
%changelog %changelog
* Mon Jan 29 2024 Florian Weimer <fweimer@redhat.com> - 2.3.12-4
- Fix out-of-bounds stack write (GCC 14 compatibility)
* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.12-3 * Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.12-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild