Created
June 10, 2009 03:37
-
-
Save knowtheory/127004 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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