Your message dated Sat, 07 Nov 2026 11:05:55 +0000
with message-id <[email protected]>
and subject line Bug#1152614: fixed in libiodbc2 3.52.16-3
has caused the Debian Bug report #1152614,
regarding libiodbc2: segfault on first SQLAllocHandle, -std=c17 hides strdup() 
prototype and truncates pointers
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
1152614: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1152614
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: libiodbc2
Version: 3.52.16-2
Severity: grave
Tags: patch
Justification: renders package unusable

Dear Maintainer,


I am the maintainer of the `odbc-sys` Rust crate. After updating the runners of the GitHub workflow to Ubuntu 26.04 my tests against iodbc started failing. I told Claude to investigate the issue and it found that the package should be build with -std=gnu17 rather than -std=c17.

Underneath the detailed root cause analysis as generated by claude

---

Since 3.52.16-1, every program linked against libiodbc2 segfaults on its
first ODBC call, allocating an environment handle with SQLAllocHandle. I
reproduced this on Ubuntu 26.04 ("resolute"), which ships 3.52.16-2
unchanged from Debian. 3.52.9-4 (Ubuntu 24.04) works fine with the same
program.

Cause
-----

3.52.16-1 started building with -std=c17 (#1097202). That is strict ISO C,
so glibc's <string.h> does not declare POSIX functions such as strdup()
and strcasecmp(). debian/rules also passes

  -Wno-implicit-function-declaration -Wno-int-conversion
  -Wno-incompatible-pointer-types

which hides the resulting diagnostics. Without these flags the build fails:

  ../include/iodbc.h:116:34: error: implicit declaration of function 'strdup' [-Wimplicit-function-declaration]   SQLGetInstalledDrivers.c:104:10: error: implicit declaration of function 'strcasecmp' [-Wimplicit-function-declaration]   SQLGetInstalledDrivers.c:167:31: error: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

Because strdup() is implicitly declared as returning int, the returned
64-bit pointer is truncated to 32 bits. In _iodbcdm_cfg_init()
(iodbcinst/inifile.c), pconfig->fileName = STRDUP(filename) stores such
a truncated pointer, and _iodbcdm_cfg_done() then calls free() on it.
This happens while the environment handle is allocated, when the driver
manager reads "AppUnicodeType" from odbcinst.ini, so every application
crashes.

Backtrace from a -g -O0 build using the flags from debian/rules (note the
32-bit value passed to free()):

  Program received signal SIGSEGV, Segmentation fault.
  #0  __GI___libc_free (mem=0x6f63e0e0) at ./malloc/malloc.c:3333
  #1  _iodbcdm_cfg_done (pconfig=0x5fe96f63e070) at inifile.c:182
  #2  _iodbcdm_cfg_init (ppconf=..., filename="/etc/odbcinst.ini", doCreate=0) at inifile.c:163   #3  _iodbcdm_cfg_search_init (ppconf=..., filename="odbcinst.ini", doCreate=0) at inifile.c:1262   #4  GetPrivateProfileString (lpszSection="ODBC", lpszEntry="AppUnicodeType", ...) at SQLGetPrivateProfileString.c:98

Reproducer
----------

  $ cat t.c
  #include <stdio.h>
  #include <sql.h>
  #include <sqlext.h>
  int main(void) {
    SQLHANDLE env, dbc;
    SQLRETURN r;
    r = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); printf("env %d\n", r);     r = SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, 0);
    r = SQLAllocHandle(SQL_HANDLE_DBC, env, &dbc); printf("dbc %d\n", r);
    SQLFreeHandle(SQL_HANDLE_DBC, dbc);
    SQLFreeHandle(SQL_HANDLE_ENV, env);
    puts("ok");
    return 0;
  }
  $ gcc t.c -I/usr/include/iodbc -liodbc -o t && ./t
  Segmentation fault (core dumped)

No odbc.ini or odbcinst.ini needs to exist.

Fix
---

Build with -std=gnu17 instead of -std=c17. This still avoids the C23
issues from #1097202 (the old-style "()" function pointer declarations),
but keeps the POSIX/GNU declarations visible. With -std=gnu17 the
upstream sources compiled cleanly with GCC 15.2.0 even without the three
-Wno-* flags, and the reproducer above runs successfully (env 0, dbc 0,
ok). I would suggest dropping those flags as well, so that problems like
this one fail the build again:

--- a/debian/rules
+++ b/debian/rules
@@
-export CFLAGS += -std=c17 -Wno-implicit-function-declaration -Wno-int-conversion -Wno-incompatible-pointer-types
+export CFLAGS += -std=gnu17

I tested this with the upstream configure/make on the 3.52.16-2 source,
not with a full dpkg-buildpackage run.

Environment where it was reproduced: Ubuntu 26.04 (Docker image
ubuntu:26.04), libiodbc2 3.52.16-2, gcc 15.2.0, x86_64.

Found via the CI of the Rust crate odbc-sys:
https://github.com/pacman82/odbc-sys/actions/runs/41037444708/job/124001751617

Regards,
Markus Klein

--- End Message ---
--- Begin Message ---
Source: libiodbc2
Source-Version: 3.52.16-3
Done: Pino Toscano <[email protected]>

We believe that the bug you reported is fixed in the latest version of
libiodbc2, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Pino Toscano <[email protected]> (supplier of updated libiodbc2 package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Sat, 07 Nov 2026 11:34:57 +0100
Source: libiodbc2
Architecture: source
Version: 3.52.16-3
Distribution: unstable
Urgency: medium
Maintainer: Debian QA Group <[email protected]>
Changed-By: Pino Toscano <[email protected]>
Closes: 1124867 1152614
Changes:
 libiodbc2 (3.52.16-3) unstable; urgency=medium
 .
   * QA upload.
   * Fix the handling of additional compiler flags:
     - append the custom build flags using DEB_CFLAGS_MAINT_APPEND, rather than
       overwriting CFLAGS; this makes the system build flags respected again
       (Closes: #1124867)
     - pass -std=gnu17 instead of -std=c17 to really bring back the default GCC
       behaviour prior to GCC 15; since the additional extensions are used, the
       CFLAGS -Wno-implicit-function-declaration -Wno-int-conversion
       -Wno-incompatible-pointer-types can be dropped, as no more needed
       (Closes: #1152614)
   * Extend the buffer in patch 06_add_system_dir.diff to 20248 characters,
     so it can fully contain the paths used for it.
   * Drop patch 05_unicode_includes.diff, as <iodbc.h> is already included.
   * Drop the leftovers of the old 'acc' autopkgtest, including the dh-acc build
     dependency.
   * Drop extremely old conflicts.
   * Include /usr/share/dpkg/architecture.mk rather than redefining variables.
   * Remove trailing whitespaces in changelog.
   * Remove the leftovers of the iodbc package, i.e. the suggests and the 
mention
     in the description of the libiodbc2 package.
Checksums-Sha1:
 cd3a8d0fe287473e8e3bb1a045c00dc214893c41 1942 libiodbc2_3.52.16-3.dsc
 37d73ea57b5b046fae0070b8582f7a0b552958a4 9440 libiodbc2_3.52.16-3.debian.tar.xz
 da10bca6b3a0d7478e952e58e9eb3308d810b513 6216 
libiodbc2_3.52.16-3_source.buildinfo
Checksums-Sha256:
 ec43601cb095f2a2bea043ca9756f17ce5ff1592823c4b90a9688ce53acef4a8 1942 
libiodbc2_3.52.16-3.dsc
 ae5988b14734446c692159aa2cc9a366cf14a45d09f83da015dfbcfd640bbc85 9440 
libiodbc2_3.52.16-3.debian.tar.xz
 db25d2862d7b7a3435bb1c380f58e0ca522854432706cf6779905d3a6a29d142 6216 
libiodbc2_3.52.16-3_source.buildinfo
Files:
 4d9d146103abcfd2cf558f5627cb6af8 1942 libs optional libiodbc2_3.52.16-3.dsc
 3ea0f2434afbeb2b1c8e90591081ac4b 9440 libs optional 
libiodbc2_3.52.16-3.debian.tar.xz
 e906f559c6dfa738c63c267aefc4624e 6216 libs optional 
libiodbc2_3.52.16-3_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEXyqfuC+mweEHcAcHLRkciEOxP00FAmru/uIACgkQLRkciEOx
P03c/hAAr1LJojHdWEdcz9NZb0z62q1ocVfCjI+8YTac9HwwZqAQsE9dulYwyeG0
RO3hC3Us2F94nHHj8ISAgmpg/M74Kb2RPTfiUJnX44eG6ht5HVrTL6Kvq9QxYYce
K5BKzigP/qmExzmNoDs3QdJzD4g38OIPnTcppxlx8YooaeFGZPXBzxnTurKPULQp
PHA6d//sNwhISuQH6ASX5IDrowVSxQlRGfLQCEbld9ZOB5W90jc1rh9BPUFqmetm
OrtC71x3MhAF0PhH6QwyWFh4ITK//QpRkFZHszsXpsZ3CtdOExLcP0+u4g71g9bq
Se33gSQxIjrc1FxvPgCLdIMMf6T8Kv/jX8zB3Av8HHO2S+z2mtNT0UBmDn6IDoE4
4KdgU8ah8Hqmf7Kn6d2UpltajG3EHxAWC/Y25ZGqpOwR17lX0vF+xErRC4URbMF7
4JrS9yluRduj2V84s4OqIBUdG41TGa4NdMVBjF0oCDfdnITewNLRsAE/UdnTRXJR
NuIyGJj0oZszt1KT+ztxN338CKjsAM+Hnyz1Z5aU/NrmOlWOUCtI5x/rm47Hgy4E
adJSGVGfzFEq+JEJuZdNStKmVIzoqCJ/S9BawPkHCuOlbx77SBVUVLBHw1B9/uri
2B83HDTYocZi2oFItyTxgAFxXGTP59NEPJ+L5kKko+xVsNcMB+o=
=3MpE
-----END PGP SIGNATURE-----

Attachment: pgp8KMilN9ERH.pgp
Description: PGP signature


--- End Message ---

Reply via email to