[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] rl_change_case: skip over invalid mbchars
From: |
Chet Ramey |
Subject: |
Re: [PATCH] rl_change_case: skip over invalid mbchars |
Date: |
Thu, 23 May 2024 16:11:26 -0400 |
User-agent: |
Mozilla Thunderbird |
On 5/23/24 3:25 PM, Grisha Levit wrote:
On Thu, May 23, 2024 at 10:25 AM Chet Ramey <chet.ramey@case.edu> wrote:
On 5/21/24 2:42 PM, Grisha Levit wrote:
Avoid using (size_t)-1 as an offset.
I can't reproduce this on macOS. Where is the code that's using -1 as an
offset?
The loop in rl_change_case does the following:
rl_change_case(count=-1, op=2) at text.c:1483:9
1481 while (start < end)
1482 {
-> 1483 c = _rl_char_value (rl_line_buffer, start);
_rl_char_value(buf="\xc0", ind=0) at mbutil.c:493:23
491 l = strlen (buf);
492 if (ind + 1 >= l)
-> 493 return ((WCHAR_T) buf[ind]);
(wchar_t) c = L'À'
Nope, this is where you lose me. Using lldb with an input file created
from the string you sent, I get c = (wchar_t) L'\U0000fffd', which fails
the rl_walphabetic test. Even running the command as you posted it just
prints `?'. What os are you using?
Maybe I'll try it some other places, but I don't have any other readily
available machines to run address sanitizer, so I'll have to eyeball it.
Maybe later.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature