[haiku-bugs] Re: [Haiku] #11322: Bash crash in iswprint while running haikuporter

  • From: "pulkomandy" <trac@xxxxxxxxxxxx>
  • Date: Mon, 06 Oct 2014 13:28:56 -0000

#11322: Bash crash in iswprint while running haikuporter
---------------------------------+----------------------------
   Reporter:  pulkomandy         |      Owner:  zooey
       Type:  bug                |     Status:  new
   Priority:  normal             |  Milestone:  R1
  Component:  System/libroot.so  |    Version:  R1/Development
 Resolution:                     |   Keywords:
 Blocked By:                     |   Blocking:
Has a Patch:  0                  |   Platform:  All
---------------------------------+----------------------------
Description changed by pulkomandy:

Old description:

> {{{
> ./haikuporter album
> }}}
>
> or
>
> {{{
> ./haikuporter --lint
> }}}
>
> bash crashes when parsing recipes which have unicode characters (in the
> case of album, in the copyright). This was apparently introduced when
> outsourcing bash.
>
> There is no gLocaleRoster in this case, and iswprint tries to use the
> 384-entries flag table for the unicode char, but this results in an out
> of range access for any non-ASCII char.
>
> So there are two bugs:
>  * gLocaleRoster shouldn't be NULL (I have tried reproducing the issue
> out of HaikuPorter, and indeed it isn't NULL in that case)
>  * The functions should not crash when gLocaleRoster is NULL and they are
> fed an unicode character.
>
> One way to fix the latter is to add bounds checks to __isctype and always
> return false for out of range characters. But I think it's better to
> investigate the first issue first.

New description:

 {{{
 ./haikuporter album
 }}}

 or

 {{{
 ./haikuporter --lint
 }}}

 bash crashes when parsing recipes which have unicode characters (in the
 case of album, in the copyright). This was apparently introduced when
 outsourcing bash.

 There is no gLocaleRoster in this case, and iswprint tries to use the
 384-entries flag table for the unicode char, but this results in an out of
 range access for any non-ASCII char.

 So there are two bugs:
  * gLocaleRoster shouldn't be NULL (I have tried reproducing the issue out
 of HaikuPorter, and indeed it isn't NULL in that case)
  * The functions should not crash when gLocaleRoster is NULL and they are
 fed an unicode character.

 One way to fix the latter is to add bounds checks to {{{__isctype}}} and
 always return false for out of range characters. But I think it's better
 to investigate the first issue first.

--

--
Ticket URL: <https://dev.haiku-os.org/ticket/11322#comment:2>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: