This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: Incorrect _Kmax value
- From: Corinna Vinschen <vinschen at redhat dot com>
- To: newlib at sourceware dot org
- Date: Thu, 10 Feb 2011 18:32:37 +0100
- Subject: Re: Incorrect _Kmax value
- References: <1297353875.4359.19.camel@manwe.oktetlabs.ru>
- Reply-to: newlib at sourceware dot org
On Feb 10 19:04, Aleksandr Platonov wrote:
> 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.
When, where and why should this happen?
The definitions and the code in question is BSD code which is used,
for instance, in NetBSD as well. The definition of _Kmax is the
same, too.
> So, it seems that _Kmax value is too big and should be (sizeof (size_t)
> << 3) - 2 or less.
Please provide a simple testcase which allows to reproduce the
problem.
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat