Re: [PATCH] newlib: Improve memory allocation for floating-point string

Corinna Vinschen <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
Hi Markus,

On Dec  5 15:20, Markus Eisenmann wrote:
> Hi!
> 
> IMHO, the commit "newlib: Fix memory leak regarding gdtoa-based _ldtoa_r()" [02/08/2023] has solved
> a memory leak issue, but I think there's still scenarios that may lead to memory corruption or exception.
> E.g., calling freedtoa() after gdto() frees the memory-block but does not invalidate the copy in the mp-result
> member in the reent-structure. Call _dtoa_r() or _ldtoa_r() afterwards will "free" this block twice and will
> corrupt the chain of free blocks.

Do you have a simple reproducer?

> In addition, I think that the previous implementation in gdto() - like used
> in phyton - that the value _Bigint::_k is stored in front of the memory instead in within the _reent-structure
> is more robust and is more flexible.

Why?  Again, do you have a reproducer to show that this has an advantage
or is more robust?


Thanks,
Corinna
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.