[Bug #2953] nkf segfaults with --numchar-input

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

e$B5/I<<Te(B: Nobuyoshi N.
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Normal
e$B%+%F%4%je(B: ext
ruby -v: 1.8.8dev (2010-02-24 ruby_1_8 26750)

http://pc12.2ch.net/test/read.cgi/tech/1267668057/375 e$B$h$j0zMQ!#e(B

$ 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.6e$B$+$ie(B1.8.8e$B$^$GF1MM$G$9!#e(B

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;

e$B%A%1%C%He(B #2953 e$B$,99?7$5$l$^$7$?!#e(B (by Nobuyoshi N.)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B
e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B

This issue was solved with changeset r26903.
Nobuyoshi, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


http://redmine.ruby-lang.org/issues/show/2953

e$B%A%1%C%He(B #2953 e$B$,99?7$5$l$^$7$?!#e(B (by Shyouhei U.)

e$B%9%F!<%?%9e(B Assignede$B$+$ie(BClosede$B$KJQ99e(B

This issue was solved with changeset r28195.
Nobuyoshi, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


http://redmine.ruby-lang.org/issues/show/2953

e$B%A%1%C%He(B #2953 e$B$,99?7$5$l$^$7$?!#e(B (by Shyouhei U.)

e$B%9%F!<%?%9e(B Closede$B$+$ie(BAssignede$B$KJQ99e(B
e$BC4Ev<Te(B Shyouhei U.e$B$+$ie(BKirk H.e$B$KJQ99e(B

Seems 1.8.6 also suffers this.

http://redmine.ruby-lang.org/issues/show/2953

e$B%A%1%C%He(B #2953 e$B$,99?7$5$l$^$7$?!#e(B (by Kirk H.)

e$B%9%F!<%?%9e(B Assignede$B$+$ie(BClosede$B$KJQ99e(B

This issue was solved with changeset r28242.
Nobuyoshi, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


http://redmine.ruby-lang.org/issues/show/2953