chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: `utf8#string-length` hangs on eof octal


From: Kon Lovett
Subject: Re: `utf8#string-length` hangs on eof octal
Date: Wed, 5 May 2021 14:45:24 -0700



On May 5, 2021, at 2:42 PM, Kon Lovett <kon@phondini.com> wrote:

same behavior w/ C5

but

#;1> (import utf8)
#;2> (valid-string? "\377\354")
#f




On May 5, 2021, at 2:20 PM, Henry Hu <henryhu@mit.edu> wrote:

Hello CHICKEN users!

I'm using CHICKEN 4.13.0 from 2017 December.  When debugging why "send eof" caused our server to hang indefinitely, I found out that utf8's string-length was the culprit:

```
$ csi
(use utf8)
(string-length "\377\354") ; line that was read from send eof
;; hangs
```

causes the interpreter to hang at least 30 seconds, probably indefinitely.  I understand that this string isn't a valid UTF-8 codepoint, but does anyone have suggestions for what to do here?  (E.g., "Upgrade to CHICKEN 5" would be a nice answer.)

Some more results that make me think the \377 octal code in particular is culpable:

```
#;4> (string-length "\354 a")
1 ; OK, since \354 isn't a valid UTF-8 char
#;5> (string-length "\366 a")
1
#;6> (string-length "\377 a")
;; Hangs
```

Thank you,
Henry
Infolab Group @ MIT
Cambridge, MA USA



reply via email to

[Prev in Thread] Current Thread [Next in Thread]