Bug #2953: nkf segfaults with --numchar-input
http://redmine.ruby-lang.org/issues/show/2953

起票者: Nobuyoshi Nakada
ステータス: Open, 優先度: Normal
カテゴリ: ext
ruby -v: 1.8.8dev (2010-02-24 ruby_1_8 26750)

http://pc12.2ch.net/test/read.cgi/tech/1267668057/375 より引用。

$ cat a.rb
require 'nkf'
sikaru = NKF.nkf('-w, --numchar-input', %w(20B9F).map{|s| "#{s};"}.join)
p sikaru
puts sikaru
$ ruby -Ku ./a.rb
a.rb:2: [BUG] Segmentation fault
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-linux]

1.8.6から1.8.8まで同様です。


Index: ext/nkf/nkf-utf8/nkf.c =================================================================== --- ext/nkf/nkf-utf8/nkf.c (revision 26898) +++ ext/nkf/nkf-utf8/nkf.c (working copy) @@ -5005,5 +5005,5 @@ nkf_char numchar_getc(FILE *f) nkf_char (*u)(nkf_char c ,FILE *f) = i_nungetc; int i = 0, j; - nkf_char buf[8]; + nkf_char buf[10]; long c = -1; ---------------------------------------- http://redmine.ruby-lang.org