[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Segfault: Lone surrogate followed by locale change
From: |
Chet Ramey |
Subject: |
Re: Segfault: Lone surrogate followed by locale change |
Date: |
Fri, 10 Nov 2017 09:08:26 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 |
On 11/10/17 8:19 AM, Eduardo A. Bustamante López wrote:
> On Fri, Nov 10, 2017 at 01:59:46PM +0100, Egmont Koblinger wrote:
> [...]
>> On Ubuntu Artful (glibc-2.26), this tiny snippet reproducibly crashes bash:
>>
>> LC_ALL=en_US.UTF-8 # or any other UTF-8 locale
>> echo -e '\ud800' # or any other lone high or low surrogate
>> LC_ALL=en_US.UTF-8 # or any available locale
>
> The problem is that Bash treats UTF-8 as a special case, so it doesn't
> initialize `localconv' to a proper value in `u32cconv', but then it calls
> `iconv_close' on the uninitialized `localconv' value during the locale switch.
Thanks for the report and the fix, which looks right.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/