Project

General

Profile

Bug #7957 » str_modify.rb

script to reproduce the issue (requires unicorn) - normalperson (Eric Wong), 02/25/2013 09:54 PM

 
require 'unicorn'
hp = Unicorn::HttpParser.new
hp.add_parse("PUT / HTTP/1.1\r\nHost:example.com\r\n" \
"Transfer-Encoding: chunked\r\n\r\n")
dst = ""
hp.filter_body(dst, "50\r\n" + ("a" * 41))
tmp = dst.dup # this line causes dst to be come shared

# this will raise: can't set length of shared string (RuntimeError)
# if dst is used as an IO#write arg
hp.filter_body(dst, ("*" * 39) << "\r\n")
(1-1/2)