From: Christopher Baines <mail@cbaines.net>
To: 62290@debbugs.gnu.org
Subject: bug#62290: Error when handling invalid unicode with suspendable ports
Date: Mon, 20 Mar 2023 09:09:14 +0000 [thread overview]
Message-ID: <874jqf6b35.fsf@cbaines.net> (raw)
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 #\� as expected the first time, but then using
suspendable ports, it raises an exception. The behaviour should be the
same.
;;; (#\�)
Backtrace:
In ice-9/boot-9.scm:
1752:10 8 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
7 (apply-smob/0 #<thunk 7f3f09cbe300>)
In ice-9/boot-9.scm:
724:2 6 (call-with-prompt ("prompt") #<procedure 7f3f09ccb320 …> …)
In ice-9/eval.scm:
619:8 5 (_ #(#(#<directory (guile-user) 7f3f09cc1c80>)))
In ice-9/boot-9.scm:
2836:4 4 (save-module-excursion #<procedure 7f3f09cb2300 at ice-…>)
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/utf8:
In procedure integer->char: Argument 1 out of range: 1199972
next reply other threads:[~2023-03-20 9:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-20 9:09 Christopher Baines [this message]
2023-03-20 9:15 ` bug#62290: [PATCH] Fix some invalid unicode handling issues with suspendable ports Christopher Baines
2023-03-20 22:27 ` bug#62290: Error when handling invalid unicode " Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874jqf6b35.fsf@cbaines.net \
--to=mail@cbaines.net \
--cc=62290@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).