Subject: bug#79194: Segfault with 0 byte symbol

From: a aa <[email-masked]>
Date: Thu, 7 Aug 2025 13:35:20 -0400

Hello,

how to reproduce:
cc main.c `pkg-config --libs --cflags guile-3.0` && ./a.out

incorrect behaviour:
The second parameter for scm_from_utf8_symboln should be how many bytes are
pointed to by the pointer however the pointer still gets read if the length
is zero. Being able to handle 0 byte strings is expected since replacing
the call from scm_from_utf8_symboln to scm_from_utf8_stringn will not have
a segfault and the documentation for this function does not mention being
unable to handle 0 byte strings.

version: 3.0.10 (built from source via gentoo ebuild)

config.guess:
x86_64-pc-linux-gnu

config.status:
--prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share
--sysconfdir=/etc --localstatedir=/var/lib --datarootdir=/usr/share
--disable-dependency-tracking --disable-silent-rules --disable-static
--docdir=/usr/share/doc/guile-3.0.10-r103
--htmldir=/usr/share/doc/guile-3.0.10-r103/html --with-sysroot=/
--libdir=/usr/lib64 --program-suffix=-3.0
--infodir=/usr/share/guile-data/3.0/info
--with-pkgconfigdir=/usr/share/guile-data/3.0/pkgconfig
--disable-error-on-warning --disable-rpath --disable-lto --enable-posix
--without-libgmp-prefix --without-libiconv-prefix --without-libintl-prefix
--without-libreadline-prefix --without-libunistring-prefix
--disable-guile-debug --disable-debug-malloc --enable-deprecated
--enable-jit --enable-networking --disable-nls --enable-regex
--with-threads build_alias=x86_64-pc-linux-gnu
host_alias=x86_64-pc-linux-gnu CC=gcc 'CFLAGS=-O2 -march=native -pipe
-std=gnu17' LDFLAGS=-fuse-ld=mold
PKG_CONFIG_PATH=/usr/share/guile-data/3.0/pkgconfig