jnewland / bigdecimal-segfault-fix forked from NZKoz/bigdecimal-segfault-fix

Provides a quick workaround for the segfault bug in Ruby (CVE-2009-1904)

This URL has Read+Write access

bigdecimal-segfault-fix / example.rb
100644 9 lines (8 sloc) 0.2 kb
1
2
3
4
5
6
7
8
9
require 'bigdecimal'
 
["9E69999999", "1" * 10_000_000].each do |value|
  begin
    puts BigDecimal(value).to_s("F")
  rescue => e
    puts "Received an exception, this is fine: #{e.inspect}"
  end
end