https://bugs.openldap.org/show_bug.cgi?id=10253
Issue ID: 10253 Summary: Compile failure with GnuTLS and GCC 14 on 32-bit Product: OpenLDAP Version: 2.6.7 Hardware: All OS: All Status: UNCONFIRMED Keywords: needs_review Severity: normal Priority: --- Component: libraries Assignee: bugs@openldap.org Reporter: ryan@openldap.org Target Milestone: ---
Debian bug report: https://bugs.debian.org/1078822
tls_g.c fails to compile on 32-bit platforms with GCC 14:
$ gcc --version gcc (Debian 14.2.0-2) 14.2.0 Copyright (C) 2024 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ gcc -dumpmachine i686-linux-gnu
$ ./configure --disable-slapd --with-tls=gnutls [...]
$ make [...] libtool: compile: cc -g -O2 -I../../include -I../../include -DLDAP_LIBRARY -c tls_g.c -fPIC -DPIC -o .libs/tls_g.o tls_g.c: In function ‘tlsg_session_pinning’: tls_g.c:971:57: error: passing argument 4 of ‘gnutls_fingerprint’ from incompatible pointer type [-Wincompatible-pointer-types] 971 | keyhash.bv_val, &keyhash.bv_len ) < 0 ) { | ^~~~~~~~~~~~~~~ | | | ber_len_t * {aka long unsigned int *} In file included from tls_g.c:44: /usr/include/gnutls/gnutls.h:2408:32: note: expected ‘size_t *’ {aka ‘unsigned int *’} but argument is of type ‘ber_len_t *’ {aka ‘long unsigned int *’} 2408 | size_t *result_size); | ~~~~~~~~^~~~~~~~~~~ make[2]: *** [Makefile:431: tls_g.lo] Error 1
It looks like the warning has always been emitted since the code was originally committed, but with GCC 14 it became an error. (See https://gcc.gnu.org/gcc-14/porting_to.html. The last successful Debian build used GCC 13.)
Quoting from the Debian bug report:
ber_len_t is typedef'ed in openldap as unsigned LBER_LEN_T, which is AC_DEFINED as long. I'm not sure what a static AC_DEFINE in configure.ac achieves, but that's what we have. On the other side, we have size_t, which happens to be 32bit. Bummer. I suggest passing the 4th argument as a temporary variable of type size_t and copying it from/to the target structure after validating that it fits.
https://bugs.openldap.org/show_bug.cgi?id=10253
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |2.5.19 Keywords|needs_review |
https://bugs.openldap.org/show_bug.cgi?id=10253
--- Comment #1 from Ryan Tandy ryan@openldap.org --- I uploaded a patch for this to Debian unstable:
https://salsa.debian.org/openldap-team/openldap/-/blob/2.5.18+dfsg-3/debian/...
I'll open a PR in a few days if I don't get any bug reports about it.
https://bugs.openldap.org/show_bug.cgi?id=10253
--- Comment #2 from Ryan Tandy ryan@openldap.org --- https://git.openldap.org/openldap/openldap/-/merge_requests/718
https://bugs.openldap.org/show_bug.cgi?id=10253
--- Comment #3 from Quanah Gibson-Mount quanah@openldap.org --- head:
• aa7b1a3d by Ryan Tandy at 2024-08-21T17:48:45-07:00 ITS#10253 Fix incompatible pointer type
https://bugs.openldap.org/show_bug.cgi?id=10253
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED
--- Comment #4 from Quanah Gibson-Mount quanah@openldap.org --- RE26:
• bfe0b374 by Ryan Tandy at 2024-10-04T21:59:24+00:00 ITS#10253 Fix incompatible pointer type with GnuTLS
RE25:
• 1a6a2ac4 by Ryan Tandy at 2024-10-04T21:58:05+00:00 ITS#10253 Fix incompatible pointer type with GnuTLS
https://bugs.openldap.org/show_bug.cgi?id=10253
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |VERIFIED