#5396: rare segfault in a terminal game
--------------------------------+-------------------------------------------
    Reporter:  MikolajKonarski  |       Owner:               
        Type:  bug              |      Status:  new          
    Priority:  normal           |   Component:  Compiler     
     Version:  7.3              |    Keywords:               
    Testcase:                   |   Blockedby:               
          Os:  Linux            |    Blocking:               
Architecture:  x86_64 (amd64)   |     Failure:  Runtime crash
--------------------------------+-------------------------------------------

Comment(by MikolajKonarski):

 Another relevant line

 
https://github.com/coreyoconnor/vty/blob/master/src/Codec/Binary/UTF8/Width.hs#L31

 BTW, I'm perplexed, because the comment in

 
http://hackage.haskell.org/packages/archive/base/latest/doc/html/src/Foreign-C-String.html#withCWStringLen

 says the string is "NUL terminated", but it's not terminated with anything
 extra --- there are just the converted characters put into an array.

 If I'm right, things can segfault a lot, e.g., with empty strings that
 don't get any C array allocated. A workaround for this in vty would be to
 change the order of arguments of conjunction in

 https://github.com/coreyoconnor/vty/blob/master/cbits/mk_wcwidth.c#L211

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5396#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to