This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Incorrect _Kmax value
- From: Aleksandr Platonov <pam at oktetlabs dot ru>
- To: newlib at sources dot redhat dot com
- Date: Thu, 10 Feb 2011 19:04:35 +0300
- Subject: Incorrect _Kmax value
- Reply-to: pam at oktetlabs dot ru
Hi,
_Kmax is defined as (sizeof (size_t) << 3) and means the maximum index
value of _REENT->_freelist array.
If the size of size_t is equal to 4 then Balloc(prt, _Kmax - 1) call
sets _maxwds to negative value. Balloc(ptr, _Kmax) call allocates memory
for sizeof (_Bigint) - sizeof(rv->_x) bytes and sets _maxwds to 0.
So, it seems that _Kmax value is too big and should be (sizeof (size_t)
<< 3) - 2 or less.
--
Aleksandr Platonov