Project

General

Profile

Bug #17382 » segfault.rb

Script to reproduce segfault - tom_dalling (Tom Dalling), 02/25/2022 06:24 AM

 
require 'json'

def trigger_segfault
JSON.parse(<<~JSON, symbolize_names: true).inspect
{
"squadName#{rand}": 1,
"homeTown#{rand}": 1,
"formed#{rand}": 2016,
"secretBase#{rand}": 1,
"active#{rand}": true,
"members#{rand}": [
{
"name#{rand}": 1,
"age#{rand}": 29,
"secretIdentity#{rand}": 1,
"powers#{rand}": [
1,
1,
1
]
},
{
"name": 1,
"age": 39,
"secretIdentity": 1,
"powers": [
1,
1,
1
]
},
{
"name": 1,
"age": 1000000,
"secretIdentity": 1,
"powers": [
1,
1,
1,
1,
1
]
}
]
}
JSON
end

i = 0
loop do
i += 1
puts "Loop #{i}"
threads = 12.times.map do
Thread.new do
1_000.times do
trigger_segfault
end
end
end
threads.map(&:join)
end
(2-2/4)