[PATCH 08/26] stdio-common: Add tst-memstream-string for open_memstream overflow

Florian Weimer fweimer@redhat.com
Mon May 23 07:03:09 GMT 2022


* Adhemerval Zanella:

> On 17/03/2022 16:29, Florian Weimer via Libc-alpha wrote:
>> This code path is exercised indirectly by some of the DNS stub
>> resolver tests, via their own use of xopen_memstream for constructing
>> strings describing result data.  The relative lack of test suite
>> coverage became apparent when these tests starting failing after a
>> printf changes uncovered bug 28949.
>
> LGTM, with maybe a suggestio below.
>
> Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

>> +/* Hide fprintf behind a compiler barrier, to avoid the fputs
>> +   transformation.  */
>> +void __attribute__ ((weak))
>> +fprintf_compiler_barrier (FILE *fp, const char *format, const char *arg)
>> +{
>> +  fprintf (fp, format, arg);
>> +}
>
> You can also avoid it by explicit disable the builtin on object build:
>
> CFLAGS-tst-memstream-string.c += -fno-builtin-fprintf

Thanks, I made this change.

Florian



More information about the Libc-alpha mailing list