ruby-changes:31425
From: nobu <ko1@a...>
Date: Fri, 1 Nov 2013 21:12:48 +0900 (JST)
Subject: [ruby-changes:31425] nobu:r43504 (trunk): transcode.c: fix segv in String.encode!
nobu 2013-11-01 21:12:44 +0900 (Fri, 01 Nov 2013) New Revision: 43504 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43504 Log: transcode.c: fix segv in String.encode! * transcode.c (str_transcode0): fix segv in String.encode!. now rb_str_scrub() can return nil. Modified files: trunk/transcode.c Index: transcode.c =================================================================== --- transcode.c (revision 43503) +++ transcode.c (revision 43504) @@ -2699,7 +2699,9 @@ str_transcode0(int argc, VALUE *argv, VA https://github.com/ruby/ruby/blob/trunk/transcode.c#L2699 if (!NIL_P(ecopts)) { rep = rb_hash_aref(ecopts, sym_replace); } - *self = rb_str_scrub(str, rep); + dest = rb_str_scrub(str, rep); + if (NIL_P(dest)) dest = str; + *self = dest; return dencidx; } return NIL_P(arg2) ? -1 : dencidx; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/