From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Baines Newsgroups: gmane.lisp.guile.bugs Subject: bug#62290: Error when handling invalid unicode with suspendable ports Date: Mon, 20 Mar 2023 09:09:14 +0000 Message-ID: <874jqf6b35.fsf@cbaines.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14078"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.8.13; emacs 28.2 To: 62290@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Mon Mar 20 10:13:24 2023 Return-path: 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 ) id 1peBZz-0003Sb-6E for guile-bugs@m.gmane-mx.org; Mon, 20 Mar 2023 10:13:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1peBZj-0001t5-9y; Mon, 20 Mar 2023 05:13:07 -0400 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 ) id 1peBZe-0001rE-T6 for bug-guile@gnu.org; Mon, 20 Mar 2023 05:13:02 -0400 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 ) id 1peBZe-0003VA-Kf for bug-guile@gnu.org; Mon, 20 Mar 2023 05:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1peBZe-0005US-4T for bug-guile@gnu.org; Mon, 20 Mar 2023 05:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 20 Mar 2023 09:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62290 X-GNU-PR-Package: guile X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.167930352821039 (code B ref -1); Mon, 20 Mar 2023 09:13:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 20 Mar 2023 09:12:08 +0000 Original-Received: from localhost ([127.0.0.1]:53686 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peBYm-0005TG-Ev for submit@debbugs.gnu.org; Mon, 20 Mar 2023 05:12:08 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:37714) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peBYl-0005T9-3U for submit@debbugs.gnu.org; Mon, 20 Mar 2023 05:12:07 -0400 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 ) id 1peBYk-0001d8-DY for bug-guile@gnu.org; Mon, 20 Mar 2023 05:12:06 -0400 Original-Received: from mira.cbaines.net ([212.71.252.8]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1peBYg-0003OU-7c for bug-guile@gnu.org; Mon, 20 Mar 2023 05:12:05 -0400 Original-Received: from localhost (unknown [IPv6:2a02:8010:68c1:0:54d1:d5d4:280e:f699]) by mira.cbaines.net (Postfix) with ESMTPSA id AA1EB16F1F for ; Mon, 20 Mar 2023 09:11:59 +0000 (GMT) Original-Received: from felis (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 077924cf for ; Mon, 20 Mar 2023 09:11:58 +0000 (UTC) Received-SPF: pass client-ip=212.71.252.8; envelope-from=mail@cbaines.net; helo=mira.cbaines.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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:10572 Archived-At: Here's a simple reproducer: (use-modules (ice-9 binary-ports) (ice-9 suspendable-ports) (rnrs bytevectors)) (define (test) (let* ((sequence '(#xf4 #xa4 #xbd #xa4)) (p (open-bytevector-input-port (u8-list->bytevector sequence)))) (set-port-encoding! p "UTF-8") (set-port-conversion-strategy! p 'substitute) (peek (read-char p)))) (test) (install-suspendable-ports!) (test) If you run it, it outputs #\=EF=BF=BD as expected the first time, but then = using suspendable ports, it raises an exception. The behaviour should be the same. ;;; (#\=EF=BF=BD) Backtrace: In ice-9/boot-9.scm: 1752:10 8 (with-exception-handler _ _ #:unwind? _ # _) In unknown file: 7 (apply-smob/0 #) In ice-9/boot-9.scm: 724:2 6 (call-with-prompt ("prompt") # =E2=80=A6) In ice-9/eval.scm: 619:8 5 (_ #(#(#))) In ice-9/boot-9.scm: 2836:4 4 (save-module-excursion #) 4388:12 3 (_) In /home/chris/Projects/Guile/guile/bad-unicode.scm: 12:10 2 (test) In ice-9/suspendable-ports.scm: 591:33 1 (read-char _) 499:12 0 (peek-char-and-next-cur/utf8 _ _ _ _) ice-9/suspendable-ports.scm:499:12: In procedure peek-char-and-next-cur/utf= 8: In procedure integer->char: Argument 1 out of range: 1199972