[PATCH] stdio: Remove memory leak from multibyte convertion (BZ#25691)

Adhemerval Zanella adhemerval.zanella@linaro.org
Thu Mar 19 20:53:45 GMT 2020



On 19/03/2020 13:49, Florian Weimer wrote:
> * Adhemerval Zanella via Libc-alpha:
> 
>> On 19/03/2020 12:52, Florian Weimer wrote:
>>> * Adhemerval Zanella via Libc-alpha:
>>>
>>>> Both default and wide printf functions might leak memory when
>>>> manipulate multibyte characters conversion depending of the size
>>>> of the input (whether __libc_use_alloca trigger or not the fallback
>>>> heap allocation).
>>>>
>>>> This patch fixes it by issuing the required memory free operation
>>>> and also change the alloca/malloc strategy to a scratch buffer.
>>>>
>>>> The testcase uses input argument size that trigger memory leaks
>>>> on unpatched code, using a scratch buffer the threashold to use
>>>> heap allocation is lower.
>>>
>>> Should we remove the malloc altogether?
>>>
>>> I think we already have patches for that.
>>>
>>
>> Which malloc exactly (there are still some in printf) and which 
>> patches are you referring ?
> 
> This seems to be it:
> 
> <https://sourceware.org/pipermail/libc-alpha/2017-June/082098.html>
> 

Hum I thought you have pushed it, but maybe you had assumed my last
message was a blocker. I will resend your version with the modifications
discussed in thread along with the testcase.


More information about the Libc-alpha mailing list