bugGNU nano - Bugs: bug #60262, invalid Unicodes above U+10FFFF...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #60262: invalid Unicodes above U+10FFFF are incorrectly presented

Submitted by:  Benno Schulenberg <bens>
Submitted on:  Sat 20 Mar 2021 10:42:48 AM UTC  
 
Severity:  3 - Normal Status:  Fixed
Assigned to:  Benno Schulenberg <bens> Open/Closed:  Open

Fri 26 Mar 2021 10:30:52 AM UTC, comment #2: 

Fixed in git, commit 92977019, by extra checks in char_length() and an mbtowide() wrapper for mbtowc() to detect codes beyond U+10FFFF.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Tue 23 Mar 2021 11:19:39 AM UTC, comment #1: 

The misdisplaying is caused by a bug in the mbtowc() and mblen() functions of glibc, as Bruno Haible pointed out in https://lists.gnu.org/archive/html/bug-gnulib/2021-03/msg00105.html:

  https://sourceware.org/bugzilla/show_bug.cgi?id=2373
  https://sourceware.org/bugzilla/show_bug.cgi?id=26034

On FreeBSD and OpenBSD and Alpine, nano displays codes above U+10FFFF correctly as four or five or six separate bytes.  NetBSD, however, has the same problem as glibc.

(On some of the BSD systems, printf does not know \x, so you have to use octal instead: printf "\365\252\252\252\252" >xxx .)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Sat 20 Mar 2021 10:42:48 AM UTC, original submission:  

To reproduce, run:

printf "\xf5\xaa\xaa\xaa\xaa" >xxx
src/nano --mini --constant xxx

See that "��" is shown.  Put the cursor on the first � and see that the minibar says U+16AAAA.  This is not a valid Unicode, so nano should not use the U+ presentation format.  Put the cursor on the second � and see that 0xAA is shown.  This is correct.

Now run:

printf "\xf4\x90\x80\x80" >xxx
src/nano --mini --constant xxx

See that "�" is shown.  Put the cursor on the � and see that the minibar says U+110000.  Also this is an invalid Unicode.

Expected behavior: nano should show four or five or six replacement characters (�) whenever a code beyond the valid Unicode range is encountered.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bens (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-03-26 bens StatusNone => Fixed
        Summaryinvalid Unicodes (above U+10FFFF) are incorrectly presented => invalid Unicodes above U+10FFFF are incorrectly presented
    2021-03-23 bens Summaryinvalid Unicodes( above U+10FFFF) are incorrectly presented => invalid Unicodes (above U+10FFFF) are incorrectly presented
    2021-03-23 bens SummaryUnicodes above U+10FFFF (which are invalid) are incorrectly presented => invalid Unicodes( above U+10FFFF) are incorrectly presented
    2021-03-23 bens Assigned toNone => bens

    Back to the top


    Powered by Savane 3.6