ruby-changes:30314
From: headius <ko1@a...>
Date: Sun, 4 Aug 2013 06:54:17 +0900 (JST)
Subject: [ruby-changes:30314] headius:r42366 (trunk): * ext/stringio/stringio.c (strio_substr): Trivial fix for invalid
headius 2013-08-04 06:53:54 +0900 (Sun, 04 Aug 2013) New Revision: 42366 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42366 Log: * ext/stringio/stringio.c (strio_substr): Trivial fix for invalid pointer when len = 0 and pos outside of string. Bug #8728. Modified files: trunk/ext/stringio/stringio.c Index: ext/stringio/stringio.c =================================================================== --- ext/stringio/stringio.c (revision 42365) +++ ext/stringio/stringio.c (revision 42366) @@ -102,6 +102,7 @@ strio_substr(struct StringIO *ptr, long https://github.com/ruby/ruby/blob/trunk/ext/stringio/stringio.c#L102 if (len > rlen) len = rlen; if (len < 0) len = 0; + if (len == 0) return rb_str_new(0,0); return rb_enc_str_new(RSTRING_PTR(str)+pos, len, enc); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/