[haiku-bugs] [Haiku] #13184: Infinite loop with bash/readline/ICU on non-BMP Unicode characters

  • From: "jessicah" <trac@xxxxxxxxxxxx>
  • Date: Mon, 09 Jan 2017 07:32:48 -0000

#13184: Infinite loop with bash/readline/ICU on non-BMP Unicode characters
-----------------------------------+------------------------------
 Reporter:  jessicah               |        Owner:  jackburton
     Type:  bug                    |       Status:  new
 Priority:  normal                 |    Milestone:  Unscheduled
Component:  Applications/Terminal  |      Version:  R1/Development
 Keywords:                         |   Blocked By:
 Blocking:                         |  Has a Patch:  0
 Platform:  All                    |
-----------------------------------+------------------------------
 When trying to cd into a directory with characters outside of the Unicode
 Basic Multilingual Plane, it triggers an infinite loop parsing the
 characters.

 I've tested the same on Ubuntu, which handles the characters fine. Note
 that they're not printable without a suitable font, but Haiku should still
 handle them correctly irregardless.

 {{{
         thread 835: bash (main)
                 state: Debugged

                 Frame           IP                      Function Name
                 -----------------------------------------------
                 0x7f5cf19f9fe0  0x12d46e62700   ucnv_toUnicode_57 + 0x60
                         Disassembly:
                                 ucnv_toUnicode_57:
                                 0x0000012d46e626a0:               55  push
 %rbp
                                 0x0000012d46e626a1:           4889e5  mov
 %rsp, %rbp
                                 0x0000012d46e626a4:             4157  push
 %r15
                                 0x0000012d46e626a6:             4156  push
 %r14
                                 0x0000012d46e626a8:             4155  push
 %r13
                                 0x0000012d46e626aa:             4154  push
 %r12
                                 0x0000012d46e626ac:               53  push
 %rbx
                                 0x0000012d46e626ad:         4883ec68  sub
 $0x68, %rsp
                                 0x0000012d46e626b1:         488b5d18  mov
 0x18(%rbp), %rbx
                                 0x0000012d46e626b5:         4c894d88  mov
 %r9, -0x78(%rbp)
                                 0x0000012d46e626b9:         448b4d10  mov
 0x10(%rbp), %r9d
                                 0x0000012d46e626bd:           4885db  test
 %rbx, %rbx
                                 0x0000012d46e626c0:             7408  jz
 0x46e626ca
                                 0x0000012d46e626c2:           448b13  mov
 (%rbx), %r10d
                                 0x0000012d46e626c5:           4585d2  test
 %r10d, %r10d
                                 0x0000012d46e626c8:             7e16  jle
 0x46e626e0
                                 0x0000012d46e626ca:         4883c468  add
 $0x68, %rsp
                                 0x0000012d46e626ce:               5b  pop
 %rbx
                                 0x0000012d46e626cf:             415c  pop
 %r12
                                 0x0000012d46e626d1:             415d  pop
 %r13
                                 0x0000012d46e626d3:             415e  pop
 %r14
                                 0x0000012d46e626d5:             415f  pop
 %r15
                                 0x0000012d46e626d7:               5d  pop
 %rbp
                                 0x0000012d46e626d8:               c3  ret
                                 0x0000012d46e626d9:   0f1f8000000000  nop
 (%rax)
                                 0x0000012d46e626e0:           4885f6  test
 %rsi, %rsi
                                 0x0000012d46e626e3:           4989d4  mov
 %rdx, %r12
                                 0x0000012d46e626e6:           4989f5  mov
 %rsi, %r13
                                 0x0000012d46e626e9:           0f94c2  setz
 %dl
                                 0x0000012d46e626ec:           4885c9  test
 %rcx, %rcx
                                 0x0000012d46e626ef:           4989ce  mov
 %rcx, %r14
                                 0x0000012d46e626f2:           0f94c0  setz
 %al
                                 0x0000012d46e626f5:             08c2  or
 %al, %dl
                                 0x0000012d46e626f7:     0f8533010000  jnz
 0x12d46e62830
                                 0x0000012d46e626fd:           4885ff  test
 %rdi, %rdi
                                 0x0000012d46e62700:           4989ff  mov
 %rdi, %r15 <--

                         Frame memory:
                                 [0x7f5cf19f9f40]  ........c..'....   00 00
 00 00 00 00 00 00 63 04 a8 27 80 01 00 00
                                 [0x7f5cf19f9f50]  ................   00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                 [0x7f5cf19f9f60]  8...\.......\...   38 00
 00 f1 5c 7f 00 00 a0 a1 9f f1 5c 7f 00 00
                                 [0x7f5cf19f9f70]  ..6}......6}....   a1 dc
 36 7d 00 02 00 00 c2 dc 36 7d 00 02 00 00
                                 [0x7f5cf19f9f80]  ....\...E..'....   e0 9f
 9f f1 5c 7f 00 00 45 13 a8 27 80 01 00 00
                                 [0x7f5cf19f9f90]  ........(...\...   00 00
 00 00 00 00 00 00 28 a0 9f f1 5c 7f 00 00
                                 [0x7f5cf19f9fa0]  ........P...\...   08 04
 00 00 00 00 00 00 50 a1 9f f1 5c 7f 00 00
                                 [0x7f5cf19f9fb0]  ..6}....8.9}....   a1 dc
 36 7d 00 02 00 00 38 c9 39 7d 00 02 00 00
                                 [0x7f5cf19f9fc0]  ....\...........   10 a0
 9f f1 5c 7f 00 00 00 00 00 00 00 00 00 00
                                 [0x7f5cf19f9fd0]  `...\......'....   60 a0
 9f f1 5c 7f 00 00 8c 14 a8 27 80 01 00 00
                 0x7f5cf19fa070  0x18027a81487
 BPrivate::Libroot::ICUCtypeData::MultibyteToWchar(wchar_t*, char const*,
 unsigned long, mbstate_t*, unsigned long&) + 0x79
                 0x7f5cf19fa0c0  0x18027a821b9
 BPrivate::Libroot::ICULocaleBackend::MultibyteToWchar(wchar_t*, char
 const*, unsigned long, mbstate_t*, unsigned long&) + 0x45
                 0x7f5cf19fa0e0  0x8eb226e146    mbrtowc + 0xd9
                 0x7f5cf19fa0f0  0x8eb226e066    __mbrlen + 0x20
                 0x7f5cf19fa130  0x1a3cd01ac07   _rl_adjust_point(char*,
 int, mbstate_t*) + 0x61 (../mbutil.c:-1)
 }}}

--
Ticket URL: <https://dev.haiku-os.org/ticket/13184>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: