diff --git a/CHANGELOG b/CHANGELOG index 09f1194..87b3947 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,7 @@ Version 0.9.0 prerelease (2009.10.13): there was a buffer overflow when value_size was equal 1 * fixed: UInt::AddVector() and UInt::SubVector() didn't want to compile when macro TTMATH_NOASM was defined + * fixed: buffer overflow in Big::ToInt(Int & result) * added: support for wide characters (wchar_t, std::wstring) * added: Big::IsInteger() returns true if the value is integer (without fraction) diff --git a/ttmath/ttmathbig.h b/ttmath/ttmathbig.h index f1b5f93..c103110 100644 --- a/ttmath/ttmathbig.h +++ b/ttmath/ttmathbig.h @@ -2011,18 +2011,20 @@ public: if( exponent > maxbit + sint(int_size*TTMATH_BITS_PER_UINT) ) // if exponent > (maxbit + sint(int_size*TTMATH_BITS_PER_UINT)) the value can't be passed // into the 'Int' type (it's too big) + return 1; if( exponent <= maxbit ) // our value is from range (-1,1) and we return zero return 0; - UInt mantissa_temp(mantissa); sint how_many_bits = exponent.ToInt(); if( how_many_bits < 0 ) { how_many_bits = -how_many_bits; uint index = how_many_bits / TTMATH_BITS_PER_UINT; + + UInt mantissa_temp(mantissa); mantissa_temp.Rcr( how_many_bits % TTMATH_BITS_PER_UINT, 0 ); for(uint i=index, a=0 ; i