From unknown Thu Aug 21 14:53:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#79194: Segfault with 0 byte symbol Resent-From: a aa Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 07 Aug 2025 17:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 79194 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 79194@debbugs.gnu.org X-Debbugs-Original-To: bug-guile@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.175458814713306 (code B ref -1); Thu, 07 Aug 2025 17:36:02 +0000 Received: (at submit) by debbugs.gnu.org; 7 Aug 2025 17:35:47 +0000 Received: from localhost ([127.0.0.1]:35792 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uk4Wp-0003SX-A8 for submit@debbugs.gnu.org; Thu, 07 Aug 2025 13:35:47 -0400 Received: from lists.gnu.org ([2001:470:142::17]:55132) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uk4Wl-0003SC-J6 for submit@debbugs.gnu.org; Thu, 07 Aug 2025 13:35:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uk4Wf-0004AC-Hx for bug-guile@gnu.org; Thu, 07 Aug 2025 13:35:37 -0400 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uk4Wd-0004si-QQ for bug-guile@gnu.org; Thu, 07 Aug 2025 13:35:37 -0400 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-5550dca1241so1210392e87.0 for ; Thu, 07 Aug 2025 10:35:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754588133; x=1755192933; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=p8SBkljZVB7aXMcqjb+7f6AByz2NvFQPA5pBemv9SKY=; b=B5rUyZVszG5oz5m1YS0kwa3JOYi1lupc+8PHqekSkQ1tW0PSvSoPyWsMy8P7EAXZnZ 2dHPjUGFUvD9qss5IZhtkwm1gfSpn8vYQU+XKwS7Jt2oDL10Mt+cJF0DWI80arIlzfeD 3uQ6tH6RLh+wCdwHpM3GZkTQACVPefS0fog5ZZbxdQ6wCxeeyr+scybGzJ0f1WytlueK BtP3f0rRXtPeLMdgKKKarClL2r0JqZ1lxESCmwXdKUJYzh1yCOChw4+6Mkmac5iRcvqo aUOZXIiCs83Bk+GL1s9oKVlM/ZuJwJPZU1CHI6KBn3wl19/8cGC3ynYmCDGWtYHM038J Oj5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754588133; x=1755192933; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=p8SBkljZVB7aXMcqjb+7f6AByz2NvFQPA5pBemv9SKY=; b=Jc+Z0mRO0qo5zKxm40AZRizC6JrG+BMhRa5k4lwgrY26DojXjE89+1lJyf510yz7yE DxUUu1MSgucGtwkO/tZx7lcpdYpcBNaX64cKmuu+pCUpVtAUevKoH69FStR6iZ2bydi4 e0C19RVtdh/uzCXSGlUX1DFrpLwupipuLhsrjD+anrgJvaLG9OHiWDzh4m4En1vxpA+M gNptf6yCxU5Wan9j4dsj1TiFmxOVkqjrHNp5e2SpHLLBfFwfJAVApccbfGr0RhAGKVZj vSFpoCDY/58orv8qBCjjIo4jw7yhhRSzXnBHBAziAav96kBU3n0xZnMmgnZvyLozXyI2 jshA== X-Gm-Message-State: AOJu0YxCvtRTRz/Bs2UyujUR5yZltLPZLriDPNOXZ6ehZNR6p9ZO8HeL lmsJBRUDwPV00+XCKJOtU4cKLaZmPR7wHuK9eOpPFvSUljv0W1nphpaW2+wZetSKzLRl9+rT6rQ iGPhm3cqwhWYs9jahncQzji8/rEx2+oaB/HO1 X-Gm-Gg: ASbGncth375qDy84mWo5IKzJnXi9AUT8BYFZVKwMQ+dNEpziXgO0VOTuYU2PiUngBq+ ctgYjbE+tgyCs+XMULXSLfmlrobI72a2Y+6Y41eCiL6JAz4O9IOajfBOyTJZqXU8JhA8kdpcQ9F +Js+VZr61/y5DMEDvcP657FK78mB7C421phywGv6MfKPnpSomdj1mbfe2qNWReqOabjqjnYXK0I E01+OU= X-Google-Smtp-Source: AGHT+IEda8n0Fp+YpZiUR2P07abyDWQ1h7Yls2Ob1fByQoteRKg3b9mQworprNSCXNnyx7Tka1EatPgRmviDPvKYo6s= X-Received: by 2002:a05:6512:3090:b0:553:35ca:5922 with SMTP id 2adb3069b0e04-55caf3c75fbmr2218041e87.56.1754588132579; Thu, 07 Aug 2025 10:35:32 -0700 (PDT) MIME-Version: 1.0 From: a aa Date: Thu, 7 Aug 2025 13:35:20 -0400 X-Gm-Features: Ac12FXwewTdEdkMsWyrRUGVt8fIYTWlcelvIJ3vX_-4I7-8yZXUe_y2qPcO8gH0 Message-ID: Content-Type: multipart/mixed; boundary="0000000000005eaf13063bc9e285" Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=lgray3420@gmail.com; helo=mail-lf1-x133.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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 hand [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (lgray3420[at]gmail.com) 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (lgray3420[at]gmail.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org] 0.0 HTML_MESSAGE BODY: HTML included in message X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) --0000000000005eaf13063bc9e285 Content-Type: multipart/alternative; boundary="0000000000005eaf11063bc9e283" --0000000000005eaf11063bc9e283 Content-Type: text/plain; charset="UTF-8" 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 --0000000000005eaf11063bc9e283 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

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

incorrect behaviour:
The second paramete= r 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 ab= le to handle 0 byte strings is expected since replacing the call from scm_f= rom_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 b= yte strings.

version: 3.0.10 (built from source vi= a gentoo ebuild)

config.guess:
x86_64-pc= -linux-gnu

config.status:
--prefix=3D/usr --bui= ld=3Dx86_64-pc-linux-gnu=20 --host=3Dx86_64-pc-linux-gnu --mandir=3D/usr/share/man=20 --infodir=3D/usr/share/info --datadir=3D/usr/share --sysconfdir=3D/etc=20 --localstatedir=3D/var/lib --datarootdir=3D/usr/share=20 --disable-dependency-tracking --disable-silent-rules --disable-static=20 --docdir=3D/usr/share/doc/guile-3.0.10-r103 --htmldir=3D/usr/share/doc/guil= e-3.0.10-r103/html --with-sysroot=3D/ --libdir=3D/usr/lib64 --program-suffi= x=3D-3.0 --infodir=3D/usr/share/guile-data/3.0/info --with-pkgconfigdir=3D/= usr/share/guile-data/3.0/pkgconfig --disable-error-on-warning --disable-rpath --disable-lto --enable-posix --without-libgmp-prefix --without-libiconv-prefix=20 --without-libintl-prefix --without-libreadline-prefix=20 --without-libunistring-prefix --disable-guile-debug=20 --disable-debug-malloc --enable-deprecated --enable-jit=20 --enable-networking --disable-nls --enable-regex --with-threads=20 build_alias=3Dx86_64-pc-linux-gnu host_alias=3Dx86_64-pc-linux-gnu=20 CC=3Dgcc 'CFLAGS=3D-O2 -march=3Dnative -pipe -std=3Dgnu17' LDFLAGS= =3D-fuse-ld=3Dmold PKG_CONFIG_PATH=3D/usr/share/guile-data/3.0/pkgconfig=C2=A0
=
--0000000000005eaf11063bc9e283-- --0000000000005eaf13063bc9e285 Content-Type: text/plain; charset="US-ASCII"; name="main.c" Content-Disposition: attachment; filename="main.c" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_me1o799f0 I2luY2x1ZGUgPGxpYmd1aWxlLmg+Cgp2b2lkKiBpbm5lcl9tYWluKHZvaWQqKSB7CiAgU0NNIHN5 bSA9IHNjbV9mcm9tX3V0Zjhfc3ltYm9sbihOVUxMLCAwKTsKCiAgcmV0dXJuIDA7Cn0KCmludCBt YWluKHZvaWQpIHsKICBzY21fd2l0aF9ndWlsZShpbm5lcl9tYWluLCAwKTsKCiAgcmV0dXJuIDA7 Cn0K --0000000000005eaf13063bc9e285-- From unknown Thu Aug 21 14:53:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#79194: Segfault with 0 byte symbol Resent-From: Tomas Volf <~@wolfsden.cz> Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sun, 10 Aug 2025 14:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 79194 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: a aa Cc: 79194@debbugs.gnu.org Received: via spool by 79194-submit@debbugs.gnu.org id=B79194.17548364822756 (code B ref 79194); Sun, 10 Aug 2025 14:35:02 +0000 Received: (at 79194) by debbugs.gnu.org; 10 Aug 2025 14:34:42 +0000 Received: from localhost ([127.0.0.1]:45607 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ul78E-0000iO-7O for submit@debbugs.gnu.org; Sun, 10 Aug 2025 10:34:42 -0400 Received: from wolfsden.cz ([37.205.8.62]:38584) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1ul789-0000iA-Ex for 79194@debbugs.gnu.org; Sun, 10 Aug 2025 10:34:40 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id 2277D3248DF; Sun, 10 Aug 2025 14:34:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1754836475; bh=7eHcpbkdR5nF1U5O3pLZhx0wWC8+zGlkK4QnzqYEaA8=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=ZphjeETQmCOn8hcwxXoociFrQ55+CmeYRDBQXEQPduNGqHhYtvbKQNUHyQ5tHMHQS NHW6kR0fFQRF65xsrzl8CL78hzeHWQMBYAM/W/hAmPtyiGBnjoTmQMiRL7xAu/ANEe y1BUg5QfOEqnu7rj5FKJ1jgvulTndQI2tKKL7F4kUEJ/Ko9vKVQ6BpZRdKD6S2NDAM V/gsXWTifTRWWWzB2mze2f1fVQWl+/YnwALG35iy9EkyETuXmz6T50Vf15RwopsrlM l1Siy4r94SIHHz19PLxnh6S8A99q1CS5HD5bYHcINlWT2AjVHlPQ2aB1HEkzmnICiv cuQXjwEt98hUNQ3JDIFCfdr7nHFR+kZ2/lVy4JEyvhyv7CAhUwI3zo4X5921zO3jxb jvXy8tqtOs0ZfVagapNmaImwXIu2FUhW0WyzKgB1KP/S3Wg/H/mbf+1Qf00ketPXDx prAbt16yMgPJYq+P/Njp3t98Zq3B9qrnCKFuKhIB0a02Ru+FtrPKf3b5a6g55Zn+3+ jqv7d2+8zX2qbHhYQwVhqde5IbB//aevatPdysEvpKr6Gi905/c5t61ZNsm6ReemVK xHdd8TZOl0ge5XDqnAC6UTVhUyVFzV1WIyEd0hk9a+cCdJZoZ/IN5jrgzhfmFuY/XA lhPUglX1xuxbmnASJiZYADEA= X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on wolfsden X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (unknown [128.0.188.242]) by wolfsden.cz (Postfix) with ESMTPSA id 48371324672; Sun, 10 Aug 2025 14:34:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1754836474; bh=7eHcpbkdR5nF1U5O3pLZhx0wWC8+zGlkK4QnzqYEaA8=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=Yk4nz9gx5u7ZXS5jHMKUFeEIfmws4J/oeHOGvuhEX1k/6dHgFAng3VWxDBSbi73oc O2R4a3wY/mRa3UnPuYMK1Ab6WzkUtwdQy/jcvxio7uni8hX9iA7iIQvPvfaAU6fNlS J8X+PVqwHQrjpy2igQZeCxuLZOdhxpkJ9ldgsaFrm9ZGByjT8x4PzTlX1BimCjuCmk bo4HcweyTdebVyuSnbhN+1LkEzfJESGMmipOf26pkzMdZv8ozyWvxaBMBQlovSeMBn bfU9BzrM/edoyDWZUANSzd8vvaWW1UZgGwNjjV6/v3K3U0aVE/IZ7VlAXCplcgJMfp oWevJ+rXH2E0HCjE6j2ep4ZoBqeYPBUdS2UBg+M94VsoIAlVVTx1FwJcEtmPneZnb2 JOOx6jq7S7TOX3QCz9nh3mlPhGeVzgK5PZTJxBxg9MRFs4j7PeR+/fl+/vIbzmeyyS Mf6xSVJ/mRn3KOhtfDYud0rjZyQgdx4gOkJmODQilfl6jn4Qchi5Q4IGzMH+6OwUmX cnjZj4a1TqULjQK/XSmlt8/zfZA+g4qb4aL+1DHXLq9damWx2k8ltuGFUHOEmUyTw9 6wlens4d3Ijj6prE7013SoxvMPyoaQJDquNVIndMqf8hnqFBG8o6f3o3evp8qec41r lYOdc5EYs7euhHRZV9JrEvk4= From: Tomas Volf <~@wolfsden.cz> In-Reply-To: (a. aa's message of "Thu, 7 Aug 2025 13:35:20 -0400") References: Date: Sun, 10 Aug 2025 16:34:33 +0200 Message-ID: <87sehz2qkm.fsf@wolfsden.cz> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi, a aa writes: > 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. Well, the scm_from_utf8_symboln is just not documented at all, so I am not sure how you have determined that the "documentation for this function does no mention ...". But let us ignore that for a moment. You wrote "handle 0 byte *strings*" (emphasis mine). That is not what you are doing. NULL is not a "0 byte string". "" (almost) is. Or a char* can be. But not NULL. > > [..] > > #include > > void* inner_main(void*) { > SCM sym = scm_from_utf8_symboln(NULL, 0); The line should be SCM sym = scm_from_utf8_symboln("", 0); or const char zero_str[] = {}; SCM sym = scm_from_utf8_symboln(zero_str, 0); Both work fine. You cannot just send a null pointer to a function that is supposed to take a string and expect it to work. So I do not think it is valid to declare this to be an "incorrect behaviour", maybe "unexpected" (by you) would be better description. Tomas -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors. From unknown Thu Aug 21 14:53:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#79194: Fwd: bug#79194: Segfault with 0 byte symbol Resent-From: a aa Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 11 Aug 2025 23:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 79194 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 79194@debbugs.gnu.org Received: via spool by 79194-submit@debbugs.gnu.org id=B79194.175495572521715 (code B ref 79194); Mon, 11 Aug 2025 23:43:02 +0000 Received: (at 79194) by debbugs.gnu.org; 11 Aug 2025 23:42:05 +0000 Received: from localhost ([127.0.0.1]:50706 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ulc9U-0005eA-8N for submit@debbugs.gnu.org; Mon, 11 Aug 2025 19:42:04 -0400 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]:50366) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ulc9O-0005dc-RQ for 79194@debbugs.gnu.org; Mon, 11 Aug 2025 19:42:01 -0400 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-55cbf3ce8c1so2875911e87.0 for <79194@debbugs.gnu.org>; Mon, 11 Aug 2025 16:41:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754955711; x=1755560511; darn=debbugs.gnu.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=SvpGBz/Jd/CTO0hGTR2EbXfYkkzU6paEU9fee3Gplh0=; b=kqU0RN1PQtVMUJMRK6kc/f3udDw30hV1oo9YhhcTgYjbVznZgLAOWSGuvsKzU3tfw2 aHKyCBpQahvcFnTl/3P4Zr7PTASyHFgWPdY3pD32kUecQtCq3ajJkaxU9H4nJXABYWaK eS8UwK2LhlQIiQl2vW5rkZAo3VKVpSyS6RpIaQwHEVlkC5/l3THOpTU6P0iUvyJcbYOz D4q+1YQkRcQVRlZBjCJxEXyYMM4nmB2sGOKbS0FSJLFN+j6QfzYuxtPIoMF2xByiySHy 9wxQWY3FGOnbeBt05dSr1D8edUKvWFPi/vKYrxZjzbRqnWgLOUpoQgKh5X1x/fxHRlRz UJSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754955711; x=1755560511; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SvpGBz/Jd/CTO0hGTR2EbXfYkkzU6paEU9fee3Gplh0=; b=l571ZznCqitXw7RtZiz0PwFPcOAT5mW6xWy+zNGJYJuCRwTiZwFZP8VTHWLZvydb3O N+eMw7qwGt9sY227Ccc1ZBhyzDOw1g0YEuVPVDH6pzvzzx3qZoP0OepcaJnBIZSZhejH whXxZPYgx4gSz3s7FoEfqc8yM73/63pSz8v3iFvlHZ85zZChcXu9+rV820vHJVFMGgAg r8gcotoRW9NPK+/ULB2s7lX1/clNPE+4dP8dNu8OXrbtCaMlKoFGGXDsrchl5yZQMNlu +Zdqe0DkcSaT3tjfc3IlTF/lofxGMb8MJI8w+bl+o6krX9iC15UAPonKCzOzi1xWF9nX KaLQ== X-Gm-Message-State: AOJu0YzMOfrrISCLvwVtqtdfkndVJyHTB2LBMDbkzftbrVgwGtWW4Tz0 b9GVSD/VidJwJScWHMb+hKxSkHM1Qrc0eDcr0iS6UxUKJHIjO4OVbbl7JQhiPuuIfXrRwCRmsUg uLzXLU9+RfAIYCxIh3hbDhY5ux8lqVy4zCA== X-Gm-Gg: ASbGncu7jLD+A3vr3xCGHdA8H3vQcZJWaku3Kfeob8gWT8tExD15piYScUw6Gco4h2e ktBloSjukVm0YEHdJuz8ja67zEmBVvsWizXGtol42UU4q4Ml6BZUEbRwME9o+BmBKMa3h0HOa6R 8q6HWM1fm09yk+fQqqruwqi+zp1c8nIqrJdW1Tqye53KRpAXLDY50k8nudQK+tjNQ1UQTdcZbD4 Lb8YVI= X-Google-Smtp-Source: AGHT+IFNb31oH/vx/TZrnQ3SLHTdnucd/Q2HAfgHtS71QQEk0zQN98TB02xodR3m9dMKapwu+ie6mMjGNtsGnVOkKCA= X-Received: by 2002:a05:6512:3e19:b0:553:2e37:6945 with SMTP id 2adb3069b0e04-55cd76028b5mr484044e87.32.1754955711041; Mon, 11 Aug 2025 16:41:51 -0700 (PDT) MIME-Version: 1.0 References: <87sehz2qkm.fsf@wolfsden.cz> In-Reply-To: From: a aa Date: Mon, 11 Aug 2025 23:41:38 +0000 X-Gm-Features: Ac12FXzMX0TYedmMzd-7r-gXp0sks0Jz2tPOFhgjPJqE4d20cldz96PmEkosVcQ Message-ID: Content-Type: multipart/mixed; boundary="000000000000c0f111063c1f77f8" X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --000000000000c0f111063c1f77f8 Content-Type: multipart/alternative; boundary="000000000000c0f110063c1f77f6" --000000000000c0f110063c1f77f6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable ---------- Forwarded message --------- From: a aa Date: Mon, Aug 11, 2025 at 11:40=E2=80=AFPM Subject: Re: bug#79194: Segfault with 0 byte symbol To: Tomas Volf <~@wolfsden.cz> Hello, Tomas <~@wolfsden.cz> > You wrote "handle 0 byte *strings*" (emphasis mine). That is not what > you are doing. NULL is not a "0 byte string". "" (almost) is. Or a > char* can be. But not NULL. The string "" does not have 0 bytes in utf8. It has 1 byte for the null terminator, which is still reading out of bounds when providing 0 for its length. I probably should have mentioned this in the first message, but I experienced this issue in rust which doesn't use null terminated strings so the example wasn't exactly accurate. rustc -lguile-3.0 main.rs or if you don't have rust c++ main.cpp `pkg-config --cflags --libs guile-3.0` > Both work fine. You cannot just send a null pointer to a function that > is supposed to take a string and expect it to work. So I do not think > it is valid to declare this to be an "incorrect behaviour", maybe > "unexpected" (by you) would be better description. The function does not take a string, it takes an array of utf8 codepoints so the function should not expect the pointer to have a null terminator. On Sun, Aug 10, 2025 at 2:34=E2=80=AFPM Tomas Volf <~@wolfsden.cz> wrote: > Hi, > > a aa writes: > > > 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 replacin= g > > 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 bei= ng > > unable to handle 0 byte strings. > > Well, the scm_from_utf8_symboln is just not documented at all, so I am > not sure how you have determined that the "documentation for this > function does no mention ...". But let us ignore that for a moment. > > You wrote "handle 0 byte *strings*" (emphasis mine). That is not what > you are doing. NULL is not a "0 byte string". "" (almost) is. Or a > char* can be. But not NULL. > > > > > [..] > > > > #include > > > > void* inner_main(void*) { > > SCM sym =3D scm_from_utf8_symboln(NULL, 0); > > The line should be > > SCM sym =3D scm_from_utf8_symboln("", 0); > > or > > const char zero_str[] =3D {}; > SCM sym =3D scm_from_utf8_symboln(zero_str, 0); > > Both work fine. You cannot just send a null pointer to a function that > is supposed to take a string and expect it to work. So I do not think > it is valid to declare this to be an "incorrect behaviour", maybe > "unexpected" (by you) would be better description. > > Tomas > > -- > There are only two hard things in Computer Science: > cache invalidation, naming things and off-by-one errors. > --000000000000c0f110063c1f77f6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


<= div dir=3D"ltr" class=3D"gmail_attr">---------- Forwarded message ---------=
From: a aa <lgray3420@gmail.com>= ;
Date: Mon, Aug 11, 2025 at 11:40=E2=80=AFPM
Subject: Re: bug= #79194: Segfault with 0 byte symbol
To: Tomas Volf <~@wolfsden.cz>



or if you don't have rust

=C2=A0 =C2=A0 c++ main.c= pp `pkg-config --cflags --libs guile-3.0`

> Both work fine= .=C2=A0 You cannot just send a null pointer to a function that
> is s= upposed to take a string and expect it to work.=C2=A0 So I do not think
= > it is valid to declare this to be an "incorrect behaviour", = maybe
> "unexpected" (by you) would be better de= scription.

The function does not take a string= , it takes an array of utf8 codepoints so the function
should= not expect the pointer to have a null terminator.

On Sun, Aug 10, 202= 5 at 2:34=E2=80=AFPM Tomas Volf <~@wolfsden.cz> wrote:
Hi,

a aa <lgray3420= @gmail.com> writes:

> 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 byte= s are
> pointed to by the pointer however the pointer still gets read if the l= ength
> is zero. Being able to handle 0 byte strings is expected since replaci= ng
> 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 be= ing
> unable to handle 0 byte strings.

Well, the scm_from_utf8_symboln is just not documented at all, so I am
not sure how you have determined that the "documentation for this
function does no mention ...".=C2=A0 But let us ignore that for a mome= nt.

You wrote "handle 0 byte *strings*" (emphasis mine).=C2=A0 That i= s not what
you are doing.=C2=A0 NULL is not a "0 byte string".=C2=A0 "&= quot; (almost) is.=C2=A0 Or a
char* can be.=C2=A0 But not NULL.

>
> [..]
>
> #include <libguile.h>
>
> void* inner_main(void*) {
>=C2=A0 =C2=A0SCM sym =3D scm_from_utf8_symboln(NULL, 0);

The line should be

=C2=A0 =C2=A0 SCM sym =3D scm_from_utf8_symboln("", 0);

or

=C2=A0 =C2=A0 const char zero_str[] =3D {};
=C2=A0 =C2=A0 SCM sym =3D scm_from_utf8_symboln(zero_str, 0);

Both work fine.=C2=A0 You cannot just send a null pointer to a function tha= t
is supposed to take a string and expect it to work.=C2=A0 So I do not think=
it is valid to declare this to be an "incorrect behaviour", maybe=
"unexpected" (by you) would be better description.

Tomas

--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.
--000000000000c0f110063c1f77f6-- --000000000000c0f111063c1f77f8 Content-Type: text/x-rust; charset="US-ASCII"; name="main.rs" Content-Disposition: attachment; filename="main.rs" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_me7q5fpm0 dXNlIHN0ZDo6ewogICAgZmZpOjp7Y19jaGFyLCBjX3ZvaWR9LAogICAgcHRyLAp9OwoKZXh0ZXJu ICJDIiB7CiAgICBmbiBzY21fd2l0aF9ndWlsZSgKICAgICAgICBfOiBPcHRpb248dW5zYWZlIGV4 dGVybiAiQyIgZm4oXzogKm11dCBjX3ZvaWQpIC0+ICptdXQgY192b2lkPiwKICAgICAgICBfOiAq bXV0IGNfdm9pZCwKICAgICkgLT4gKm11dCBjX3ZvaWQ7CiAgICBmbiBzY21fZnJvbV91dGY4X3N5 bWJvbG4oXzogKmNvbnN0IGNfY2hhciwgXzogdXNpemUpIC0+ICptdXQgY192b2lkOwp9Cgp1bnNh ZmUgZXh0ZXJuICJDIiBmbiBpbm5lcl9tYWluKF86ICptdXQgY192b2lkKSAtPiAqbXV0IGNfdm9p ZCB7CiAgICBsZXQgc3RyID0gIiI7CiAgICB1bnNhZmUgewogICAgICAgIHNjbV9mcm9tX3V0Zjhf c3ltYm9sbihzdHIuYXNfcHRyKCkuY2FzdCgpLCBzdHIubGVuKCkpOwogICAgfQoKICAgIHB0cjo6 bnVsbF9tdXQoKQp9CgpmbiBtYWluKCkgewogICAgdW5zYWZlIHsKICAgICAgICBzY21fd2l0aF9n dWlsZShTb21lKGlubmVyX21haW4pLCBwdHI6Om51bGxfbXV0KCkpOwogICAgfQp9Cg== --000000000000c0f111063c1f77f8 Content-Type: text/x-c-code; charset="US-ASCII"; name="main.cpp" Content-Disposition: attachment; filename="main.cpp" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_me7q5o9y1 I2luY2x1ZGUgPGxpYmd1aWxlLmg+CiNpbmNsdWRlIDx2ZWN0b3I+Cgp2b2lkKiBpbm5lcl9tYWlu KHZvaWQqKSB7CiAgc3RkOjp2ZWN0b3I8Y2hhcj4gcmF3X3plcm9fdXRmOF9zdHIgPSB7fTsKICBT Q00gc3ltID0gc2NtX2Zyb21fdXRmOF9zeW1ib2xuKHJhd196ZXJvX3V0Zjhfc3RyLmRhdGEoKSwg cmF3X3plcm9fdXRmOF9zdHIuc2l6ZSgpKTsKICAKICByZXR1cm4gTlVMTDsKfQoKaW50IG1haW4o dm9pZCkgewogIHNjbV93aXRoX2d1aWxlKGlubmVyX21haW4sIE5VTEwpOwoKICByZXR1cm4gMDsK fQo= --000000000000c0f111063c1f77f8-- From unknown Thu Aug 21 14:53:56 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: a aa Subject: bug#79194: closed (bug#79194: Segfault with 0 byte symbol) Message-ID: References: <87qzxf5ssq.fsf@wolfsden.cz> X-Gnu-PR-Message: they-closed 79194 X-Gnu-PR-Package: guile Reply-To: 79194@debbugs.gnu.org Date: Wed, 13 Aug 2025 12:08:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1755086882-16850-1" This is a multi-part message in MIME format... ------------=_1755086882-16850-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #79194: Segfault with 0 byte symbol which was filed against the guile package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 79194@debbugs.gnu.org. --=20 79194: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D79194 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1755086882-16850-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 79194-done) by debbugs.gnu.org; 13 Aug 2025 12:07:29 +0000 Received: from localhost ([127.0.0.1]:56662 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1umAGP-0004Mi-43 for submit@debbugs.gnu.org; Wed, 13 Aug 2025 08:07:29 -0400 Received: from wolfsden.cz ([37.205.8.62]:57720) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1umAGI-0004MO-BV for 79194-done@debbugs.gnu.org; Wed, 13 Aug 2025 08:07:26 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id 5E65B3656CC; Wed, 13 Aug 2025 12:07:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1755086839; bh=ikkhtjhHhxQsuVSTD5PMdo5hw84io3vutXdJPMzEiS8=; h=From:To:Subject:Date; b=ifqNom8ty6dr8sQaeZwJHOLlgxxzOopMclgyMYKWuQcPxJ7AAdf69cLeRx0xlTYht zAck9ZrPLiOftCN17rVFbUewjFM7ZA4Yrj7n+R9P9W+bUtgDc6O2mvDK0bGee1zzXt QYfEFIZnKEddgn7hVLYD6Wov9lz8ANZJs1rIIXTUh0kJb2EGHQe4DIWBu0lPUWrlGM AR+4LKde5MFTAUWcVAB6WdeX4HglXMCQtOFPyL32pUKrylvjQphztht+tbjxwJ3CIi inEoV9c+265/gdT7K76D86U7eUAyA1JwO6Zsr3XgyNqNVCvkNXNOJVU8qrsZI1Rb73 3LmGp4liug51ZwJ96LpnPcBowxxpCFKPsyKfEYAcChIkyKqVr1T73/pGyiqAqEwPhG RB4Xn8ue2TwcATS5GN30bG7UW8wBKoOmJKRJ9zEx6z0eON31V0HE75RJCixhhSlj5o BTN0duhIy6lDecucztlGLloxo4i5mnruH7csCSWfTx90mwMgwN+Xa94VReIps710gx iKs79QncLwqjUI8EU90qhltJXehIRV8Sm1Qt5LKkpoUHRZZTG+x3hgwy3X8hyLQU71 nGrkBaVfKwP7PpSJz33DWsOEmLvDyzyX+fS8fDLCfbd0icgzRP/hub9Vy9f5gHB8oP MdQLf0hAP9Lq+86HKitPe43I= X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on wolfsden X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (unknown [128.0.188.242]) by wolfsden.cz (Postfix) with ESMTPSA id 274DD366AA0 for <79194-done@debbugs.gnu.org>; Wed, 13 Aug 2025 12:07:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1755086838; bh=ikkhtjhHhxQsuVSTD5PMdo5hw84io3vutXdJPMzEiS8=; h=From:To:Subject:Date; b=rtJgAknrwtpCHHB0Iei8EUc4MUtOPBBNjNzYUdOcUMueBb3upkgZWOeW8j4E7wywl 0X1LiSgk1wwTmGZZbKY3GOIIUYau/3LWHxHTJrBeGEgye5CaDuxynklAc7h7ysaYiN FylPZNbGmQnoaeLiJ4xPK8U0gfg/zOQfrj44ZWibdX1xRYeRjXRp093uwzc5Jth3tC W3ERjTN5txofdVZPwzT9e/kmwkYtOep8Ouy2jKCzaFqpNkQblnT2jT+pkjLRu7sGFl r6rilVtjpZNAWz++2uqjTEZaAe84b5M5Nvib4i3HzygOOjw82Y6olmZDBVobtxnary B0SFwRnWnVSwhXqUE0CeJVANFOtGkILtUdrXekOb3A6dA4PkefN2ikD6h4SuZ6exSs +g2L9s+oq+Q5xUc0Ho0OV4ci94eKUQ3TvSlSP+Hnj+UXr1FongKfRUQTBLU10gjoZi muS6SFBLrge+w9VfD1djxK7HmtBPG2Tr9PcnHzIacGAHnxzNGvINme1yUMKu+In7D1 int8mi88Rm7jpDnQUt5rt4wgCz0Ta62TbjoSbOUx1psvuABA70E4wNTLiZTUW76GtS YEq2gr4QUp2kfBEqyBDRgxxroeR59JbTHPlpioBt0+Tqppfhsc8vES8iSDvXY1p3ZC q+UuHVzb7EPtKl2gTizgONH4= From: Tomas Volf <~@wolfsden.cz> To: 79194-done@debbugs.gnu.org Subject: bug#79194: Segfault with 0 byte symbol Date: Wed, 13 Aug 2025 14:07:17 +0200 Message-ID: <87qzxf5ssq.fsf@wolfsden.cz> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79194-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Was fixed in 35f13806af653ef9ed656708dddcd1d2c8f8da9e. Closing. -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors. ------------=_1755086882-16850-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 7 Aug 2025 17:35:47 +0000 Received: from localhost ([127.0.0.1]:35792 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uk4Wp-0003SX-A8 for submit@debbugs.gnu.org; Thu, 07 Aug 2025 13:35:47 -0400 Received: from lists.gnu.org ([2001:470:142::17]:55132) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uk4Wl-0003SC-J6 for submit@debbugs.gnu.org; Thu, 07 Aug 2025 13:35:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uk4Wf-0004AC-Hx for bug-guile@gnu.org; Thu, 07 Aug 2025 13:35:37 -0400 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uk4Wd-0004si-QQ for bug-guile@gnu.org; Thu, 07 Aug 2025 13:35:37 -0400 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-5550dca1241so1210392e87.0 for ; Thu, 07 Aug 2025 10:35:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754588133; x=1755192933; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=p8SBkljZVB7aXMcqjb+7f6AByz2NvFQPA5pBemv9SKY=; b=B5rUyZVszG5oz5m1YS0kwa3JOYi1lupc+8PHqekSkQ1tW0PSvSoPyWsMy8P7EAXZnZ 2dHPjUGFUvD9qss5IZhtkwm1gfSpn8vYQU+XKwS7Jt2oDL10Mt+cJF0DWI80arIlzfeD 3uQ6tH6RLh+wCdwHpM3GZkTQACVPefS0fog5ZZbxdQ6wCxeeyr+scybGzJ0f1WytlueK BtP3f0rRXtPeLMdgKKKarClL2r0JqZ1lxESCmwXdKUJYzh1yCOChw4+6Mkmac5iRcvqo aUOZXIiCs83Bk+GL1s9oKVlM/ZuJwJPZU1CHI6KBn3wl19/8cGC3ynYmCDGWtYHM038J Oj5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754588133; x=1755192933; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=p8SBkljZVB7aXMcqjb+7f6AByz2NvFQPA5pBemv9SKY=; b=Jc+Z0mRO0qo5zKxm40AZRizC6JrG+BMhRa5k4lwgrY26DojXjE89+1lJyf510yz7yE DxUUu1MSgucGtwkO/tZx7lcpdYpcBNaX64cKmuu+pCUpVtAUevKoH69FStR6iZ2bydi4 e0C19RVtdh/uzCXSGlUX1DFrpLwupipuLhsrjD+anrgJvaLG9OHiWDzh4m4En1vxpA+M gNptf6yCxU5Wan9j4dsj1TiFmxOVkqjrHNp5e2SpHLLBfFwfJAVApccbfGr0RhAGKVZj vSFpoCDY/58orv8qBCjjIo4jw7yhhRSzXnBHBAziAav96kBU3n0xZnMmgnZvyLozXyI2 jshA== X-Gm-Message-State: AOJu0YxCvtRTRz/Bs2UyujUR5yZltLPZLriDPNOXZ6ehZNR6p9ZO8HeL lmsJBRUDwPV00+XCKJOtU4cKLaZmPR7wHuK9eOpPFvSUljv0W1nphpaW2+wZetSKzLRl9+rT6rQ iGPhm3cqwhWYs9jahncQzji8/rEx2+oaB/HO1 X-Gm-Gg: ASbGncth375qDy84mWo5IKzJnXi9AUT8BYFZVKwMQ+dNEpziXgO0VOTuYU2PiUngBq+ ctgYjbE+tgyCs+XMULXSLfmlrobI72a2Y+6Y41eCiL6JAz4O9IOajfBOyTJZqXU8JhA8kdpcQ9F +Js+VZr61/y5DMEDvcP657FK78mB7C421phywGv6MfKPnpSomdj1mbfe2qNWReqOabjqjnYXK0I E01+OU= X-Google-Smtp-Source: AGHT+IEda8n0Fp+YpZiUR2P07abyDWQ1h7Yls2Ob1fByQoteRKg3b9mQworprNSCXNnyx7Tka1EatPgRmviDPvKYo6s= X-Received: by 2002:a05:6512:3090:b0:553:35ca:5922 with SMTP id 2adb3069b0e04-55caf3c75fbmr2218041e87.56.1754588132579; Thu, 07 Aug 2025 10:35:32 -0700 (PDT) MIME-Version: 1.0 From: a aa Date: Thu, 7 Aug 2025 13:35:20 -0400 X-Gm-Features: Ac12FXwewTdEdkMsWyrRUGVt8fIYTWlcelvIJ3vX_-4I7-8yZXUe_y2qPcO8gH0 Message-ID: Subject: Segfault with 0 byte symbol To: bug-guile@gnu.org Content-Type: multipart/mixed; boundary="0000000000005eaf13063bc9e285" Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=lgray3420@gmail.com; helo=mail-lf1-x133.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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 hand [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (lgray3420[at]gmail.com) 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (lgray3420[at]gmail.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org] 0.0 HTML_MESSAGE BODY: HTML included in message X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) --0000000000005eaf13063bc9e285 Content-Type: multipart/alternative; boundary="0000000000005eaf11063bc9e283" --0000000000005eaf11063bc9e283 Content-Type: text/plain; charset="UTF-8" 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 --0000000000005eaf11063bc9e283 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

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

incorrect behaviour:
The second paramete= r 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 ab= le to handle 0 byte strings is expected since replacing the call from scm_f= rom_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 b= yte strings.

version: 3.0.10 (built from source vi= a gentoo ebuild)

config.guess:
x86_64-pc= -linux-gnu

config.status:
--prefix=3D/usr --bui= ld=3Dx86_64-pc-linux-gnu=20 --host=3Dx86_64-pc-linux-gnu --mandir=3D/usr/share/man=20 --infodir=3D/usr/share/info --datadir=3D/usr/share --sysconfdir=3D/etc=20 --localstatedir=3D/var/lib --datarootdir=3D/usr/share=20 --disable-dependency-tracking --disable-silent-rules --disable-static=20 --docdir=3D/usr/share/doc/guile-3.0.10-r103 --htmldir=3D/usr/share/doc/guil= e-3.0.10-r103/html --with-sysroot=3D/ --libdir=3D/usr/lib64 --program-suffi= x=3D-3.0 --infodir=3D/usr/share/guile-data/3.0/info --with-pkgconfigdir=3D/= usr/share/guile-data/3.0/pkgconfig --disable-error-on-warning --disable-rpath --disable-lto --enable-posix --without-libgmp-prefix --without-libiconv-prefix=20 --without-libintl-prefix --without-libreadline-prefix=20 --without-libunistring-prefix --disable-guile-debug=20 --disable-debug-malloc --enable-deprecated --enable-jit=20 --enable-networking --disable-nls --enable-regex --with-threads=20 build_alias=3Dx86_64-pc-linux-gnu host_alias=3Dx86_64-pc-linux-gnu=20 CC=3Dgcc 'CFLAGS=3D-O2 -march=3Dnative -pipe -std=3Dgnu17' LDFLAGS= =3D-fuse-ld=3Dmold PKG_CONFIG_PATH=3D/usr/share/guile-data/3.0/pkgconfig=C2=A0
=
--0000000000005eaf11063bc9e283-- --0000000000005eaf13063bc9e285 Content-Type: text/plain; charset="US-ASCII"; name="main.c" Content-Disposition: attachment; filename="main.c" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_me1o799f0 I2luY2x1ZGUgPGxpYmd1aWxlLmg+Cgp2b2lkKiBpbm5lcl9tYWluKHZvaWQqKSB7CiAgU0NNIHN5 bSA9IHNjbV9mcm9tX3V0Zjhfc3ltYm9sbihOVUxMLCAwKTsKCiAgcmV0dXJuIDA7Cn0KCmludCBt YWluKHZvaWQpIHsKICBzY21fd2l0aF9ndWlsZShpbm5lcl9tYWluLCAwKTsKCiAgcmV0dXJuIDA7 Cn0K --0000000000005eaf13063bc9e285-- ------------=_1755086882-16850-1--