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: