Skip to content

Instantly share code, notes, and snippets.

@knowtheory
Created June 10, 2009 03:37
Show Gist options
  • Select an option

  • Save knowtheory/127004 to your computer and use it in GitHub Desktop.

Select an option

Save knowtheory/127004 to your computer and use it in GitHub Desktop.
# This file does not trigger the BigDecimal bug indicated here: http://www.ruby-lang.org/en/news/2009/06/09/dos-vulnerability-in-bigdecimal/
require 'rubygems'
require 'dm-core'
class BigDec
include DataMapper::Resource
property :id, Serial
property :value, BigDecimal
end
DataMapper.setup(:default, :adapter=>:in_memory)
puts "Create"
b = BigDec.create(:value => "9E69999999")
puts "Find"
b = BigDec.first
puts "Access Value"
b.value
puts "Value of b: #{b.value}"
# This file triggers the BigDecimal bug indicated here: http://www.ruby-lang.org/en/news/2009/06/09/dos-vulnerability-in-bigdecimal/
require 'rubygems'
require 'dm-core'
require 'dm-validations'
class BigDec
include DataMapper::Resource
property :id, Serial
property :value, BigDecimal
end
DataMapper.setup(:default, :adapter=>:in_memory)
puts "Create"
b = BigDec.create(:value => "9E69999999")
puts "Find"
b = BigDec.first
puts "Access Value"
b.value
puts "Value of b: #{b.value}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment