Reproducable bug

Hello,

So here’s the code:

----- BEGIN CODE -----

require ‘socket’

sock = TCPSocket.new (SERVER_ADDRESS, SERVER_PORT)

a = 'a’
a[0…0] = ''
sock.puts(String.new(a)) # CRASH!

puts ‘We never get here.’

----- END CODE -----

Just fill in your favorite ip address and port.

I don’t know if this is a bug in Array[]=, or in String.new (which I
doubt, but if you just use ‘a’ instead of ‘String.new(a)’, it doesn’t crash)
or a TCPSocket problem, but you have to use all of these for it to crash.

If it matters, I am using the 1.7.2 windows build from rubycentral.com:

ruby 1.7.2 (2002-07-02) [i386-mswin32]

So… any takers?

Chris

Hi,

···

In message “reproducable bug” on 02/10/09, “Chris Pine” newsgroups@hellotree.com writes:

Just fill in your favorite ip address and port.

It doesn’t crash on my machine. Try newer ruby. And if it won’t go,
please tell me how it crash along with exact error message you get.

						matz.

----- BEGIN CODE -----
[…]
----- END CODE -----

% cat rb.rb
require ‘socket’

sock = TCPSocket.new (“127.0.0.1”, “80”)

a = ‘a’
a[0…0] = ‘’
sock.puts(String.new(a)) # CRASH!

puts ‘We never get here.’
% ruby rb.rb
We never get here.
% ruby -v
ruby 1.7.3 (2002-09-23) [i586-linux]
% _

Won’t work for me…

···

On Wed, Oct 09, 2002 at 01:11:01PM +0900, Chris Pine wrote:


[ Wojtek gminick Walczak ][ http://gminick.linuxsecurity.pl/ ]
[ gminick (at) hacker.pl ][ gminick (at) underground.org.pl/ ]

puts 'We never get here.'

this is this modification

···

Fri Sep 6 10:34:32 2002 Minero Aoki <aamine@loveruby.net>

  * io.c (rb_io_puts): RSTRING(line)->ptr might be NULL.

Guy Decoux