annotate .svn/pristine/11/111782291673fa0d25a1477bea1c5d346d154c35.svn-base @ 1519:afce8026aaeb redmine-2.4-integration

Merge from branch "live"
author Chris Cannam
date Tue, 09 Sep 2014 09:34:53 +0100
parents cbb26bc654de
children
rev   line source
Chris@909 1 # Copyright (c) 2009 Michael Koziarski <michael@koziarski.com>
Chris@909 2 #
Chris@909 3 # Permission to use, copy, modify, and/or distribute this software for any
Chris@909 4 # purpose with or without fee is hereby granted, provided that the above
Chris@909 5 # copyright notice and this permission notice appear in all copies.
Chris@909 6 #
Chris@909 7 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
Chris@909 8 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
Chris@909 9 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
Chris@909 10 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
Chris@909 11 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
Chris@909 12 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
Chris@909 13 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Chris@909 14
Chris@909 15 require 'bigdecimal'
Chris@909 16
Chris@909 17 alias BigDecimalUnsafe BigDecimal
Chris@909 18
Chris@909 19
Chris@909 20 # This fixes CVE-2009-1904 however it removes legitimate functionality that your
Chris@909 21 # application may depend on. You are *strongly* advised to upgrade your ruby
Chris@909 22 # rather than relying on this fix for an extended period of time.
Chris@909 23
Chris@909 24 def BigDecimal(initial, digits=0)
Chris@909 25 if initial.size > 255 || initial =~ /e/i
Chris@909 26 raise "Invalid big Decimal Value"
Chris@909 27 end
Chris@909 28 BigDecimalUnsafe(initial, digits)
Chris@909 29 end
Chris@909 30