From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: festerdam@posteo.net
Newsgroups: gmane.lisp.guile.bugs
Subject: bug#60487: string-ref segfaults with n < 0 on Guile 3.0.8
Date: Mon, 02 Jan 2023 04:12:33 +0000
Message-ID: <b7b6bcbafd7e0fed8f044fee3ceed060@posteo.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII;
 format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="21142"; mail-complaints-to="usenet@ciao.gmane.io"
To: 60487@debbugs.gnu.org
Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Mon Jan 02 09:54:35 2023
Return-path: <bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org>
Envelope-to: guile-bugs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org>)
	id 1pCGaX-0005Kt-Sc
	for guile-bugs@m.gmane-mx.org; Mon, 02 Jan 2023 09:54:33 +0100
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-guile-bounces@gnu.org>)
	id 1pCGa6-0006KY-4i; Mon, 02 Jan 2023 03:54:06 -0500
Original-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 <Debian-debbugs@debbugs.gnu.org>)
 id 1pCGa2-0006Jf-Mq
 for bug-guile@gnu.org; Mon, 02 Jan 2023 03:54:02 -0500
Original-Received: from debbugs.gnu.org ([209.51.188.43])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1pCGa2-0000Ct-EM
 for bug-guile@gnu.org; Mon, 02 Jan 2023 03:54:02 -0500
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1pCGa1-0005TF-Uh
 for bug-guile@gnu.org; Mon, 02 Jan 2023 03:54:01 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: festerdam@posteo.net
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-guile@gnu.org
Resent-Date: Mon, 02 Jan 2023 08:54:01 +0000
Resent-Message-ID: <handler.60487.B.167264963521004@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: report 60487
X-GNU-PR-Package: guile
X-Debbugs-Original-To: bug-guile@gnu.org
Original-Received: via spool by submit@debbugs.gnu.org id=B.167264963521004
 (code B ref -1); Mon, 02 Jan 2023 08:54:01 +0000
Original-Received: (at submit) by debbugs.gnu.org; 2 Jan 2023 08:53:55 +0000
Original-Received: from localhost ([127.0.0.1]:42407 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1pCGZu-0005Sh-Ni
 for submit@debbugs.gnu.org; Mon, 02 Jan 2023 03:53:55 -0500
Original-Received: from lists.gnu.org ([209.51.188.17]:60828)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <festerdam@posteo.net>) id 1pCCBl-00045E-FK
 for submit@debbugs.gnu.org; Sun, 01 Jan 2023 23:12:41 -0500
Original-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 <festerdam@posteo.net>)
 id 1pCCBl-0003Cl-7m
 for bug-guile@gnu.org; Sun, 01 Jan 2023 23:12:41 -0500
Original-Received: from mout02.posteo.de ([185.67.36.66])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <festerdam@posteo.net>)
 id 1pCCBj-0001Bd-6B
 for bug-guile@gnu.org; Sun, 01 Jan 2023 23:12:40 -0500
Original-Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 58529240314
 for <bug-guile@gnu.org>; Mon,  2 Jan 2023 05:12:35 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1672632755; bh=Q8GQ0g0g4/h8iiJE2a0X5kQxgyI6NK0CpLvOvY2gb2Q=;
 h=Date:From:To:Subject:From;
 b=FGa/aq9k0T7vzTIqwfsfFcqAMN7uy4+Z1XheFp8aRS2AFPd2Z5pwPT8zFLFmZAuIA
 70P+1gjx7b4Iac1hMojU6ZcYCSDsn8ZZCNJh1J9iq4L2pSCYZargUHA9c1pPNuhh1Q
 9z6Tz4opv2Pu77SBgLVXDhncymDYnywjHoVq/LEWFDEq5ixqrdLTMSFmylBMTA6KSe
 iSntOhR4Wc6kK5o5VwWg6AShlV/aETuBbHlkSguTQJQed/NdbYFpvH4NPwBuuHjMSv
 7Znewr3fqLebgLia5gZ6XWgWrkkO/+W/xJ+DA1ws+bRqMhk3jVE5VZAz9FJrfm3gX1
 uhKWuxppi8YxA==
Original-Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4NljBV58wMz6trh
 for <bug-guile@gnu.org>; Mon,  2 Jan 2023 05:12:33 +0100 (CET)
Received-SPF: pass client-ip=185.67.36.66; envelope-from=festerdam@posteo.net; 
 helo=mout02.posteo.de
X-Spam_score_int: -43
X-Spam_score: -4.4
X-Spam_bar: ----
X-Spam_report: (-4.4 / 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,
 RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Mailman-Approved-At: Mon, 02 Jan 2023 03:53:53 -0500
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: bug-guile@gnu.org
List-Id: "Bug reports for GUILE,
 GNU's Ubiquitous Extension Language" <bug-guile.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-guile>,
 <mailto:bug-guile-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-guile>
List-Post: <mailto:bug-guile@gnu.org>
List-Help: <mailto:bug-guile-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-guile>,
 <mailto:bug-guile-request@gnu.org?subject=subscribe>
Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org
Original-Sender: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.lisp.guile.bugs:10495
Archived-At: <http://permalink.gmane.org/gmane.lisp.guile.bugs/10495>

The following code results in a segmentation fault on Guile 
3.0.8-deb+3.0.8-2 (obtained from the Debian repositories):
     (string-ref "my string" -3)

gdb's backtrace is the following:

#0  0x00007ffff7f1bcc5 in ?? () from 
/lib/x86_64-linux-gnu/libguile-3.0.so.1
#1  0x00007ffff7f26c49 in scm_call_n ()
    from /lib/x86_64-linux-gnu/libguile-3.0.so.1
#2  0x00007ffff7e97b29 in scm_apply_0 ()
    from /lib/x86_64-linux-gnu/libguile-3.0.so.1
#3  0x00007ffff7f15966 in scm_throw ()
    from /lib/x86_64-linux-gnu/libguile-3.0.so.1
#4  0x00007ffff7f174e9 in scm_ithrow ()
    from /lib/x86_64-linux-gnu/libguile-3.0.so.1
#5  0x00007ffff7e94735 in scm_error_scm ()
    from /lib/x86_64-linux-gnu/libguile-3.0.so.1
#6  0x00007ffff7e94790 in scm_error ()
    from /lib/x86_64-linux-gnu/libguile-3.0.so.1
#7  0x00007ffff7ee19e7 in ?? () from 
/lib/x86_64-linux-gnu/libguile-3.0.so.1
#8  0x00007ffff7ee208b in scm_to_uint64 ()
    from /lib/x86_64-linux-gnu/libguile-3.0.so.1
#9  0x00007ffff7f1c5e4 in ?? () from 
/lib/x86_64-linux-gnu/libguile-3.0.so.1
#10 0x00007ffff7f26c49 in scm_call_n ()
    from /lib/x86_64-linux-gnu/libguile-3.0.so.1
#11 0x00007ffff7e93a97 in scm_primitive_eval ()
    from /lib/x86_64-linux-gnu/libguile-3.0.so.1
#12 0x00007ffff7e99a86 in scm_eval ()
    from /lib/x86_64-linux-gnu/libguile-3.0.so.1
#13 0x00007ffff7ef91c6 in scm_shell () from 
/lib/x86_64-linux-gnu/libguile-3.0.so.1
#14 0x00007ffff7ea865c in ?? () from 
/lib/x86_64-linux-gnu/libguile-3.0.so.1
#15 0x00007ffff7e91f6a in ?? () from 
/lib/x86_64-linux-gnu/libguile-3.0.so.1
#16 0x00007ffff7f194e8 in ?? () from 
/lib/x86_64-linux-gnu/libguile-3.0.so.1
#17 0x00007ffff7f26c49 in scm_call_n () from 
/lib/x86_64-linux-gnu/libguile-3.0.so.1
#18 0x00007ffff7e936ea in scm_call_2 () from 
/lib/x86_64-linux-gnu/libguile-3.0.so.1
#19 0x00007ffff7f42292 in ?? () from 
/lib/x86_64-linux-gnu/libguile-3.0.so.1
#20 0x00007ffff7f0ff4f in scm_c_catch () from 
/lib/x86_64-linux-gnu/libguile-3.0.so.1
#21 0x00007ffff7e942e6 in scm_c_with_continuation_barrier () from 
/lib/x86_64-linux-gnu/libguile-3.0.so.1
#22 0x00007ffff7f14b89 in ?? () from 
/lib/x86_64-linux-gnu/libguile-3.0.so.1
#23 0x00007ffff7c190e7 in GC_call_with_stack_base () from 
/lib/x86_64-linux-gnu/libgc.so.1
#24 0x00007ffff7f0fe68 in scm_with_guile () from 
/lib/x86_64-linux-gnu/libguile-3.0.so.1
#25 0x00007ffff7eb1185 in scm_boot_guile () from 
/lib/x86_64-linux-gnu/libguile-3.0.so.1
#26 0x000055555555510f in ?? ()
#27 0x00007ffff7c9918a in __libc_start_call_main 
(main=main@entry=0x5555555550b0, argc=argc@entry=1, 
argv=argv@entry=0x7fffffffe0b8) at 
../sysdeps/nptl/libc_start_call_main.h:58
#28 0x00007ffff7c99245 in __libc_start_main_impl (main=0x5555555550b0, 
argc=1, argv=0x7fffffffe0b8, init=<optimized out>, fini=<optimized out>, 
rtld_fini=<optimized out>, stack_end=0x7fffffffe0a8) at 
../csu/libc-start.c:381
#29 0x00005555555551aa in ?? ()