This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Uninitialized structure in printing functions


Hi, I've just found that with -O0 both my tests and the newlib's
testsuite work as expected, even removing the uio initialization
provided in the patch.

This is a bit weird. My cross compiler is GCC 4.9.4: is it possible
that newlib is not actually tested with this version?


Giacomo

2017-04-26 11:35 GMT+02:00 Giacomo Tesio <giacomo@tesio.it>:
> Hi Corinna,
>
> I was trying to fix a simple "hello, world" test:
> https://github.com/JehanneOS/jehanne/blob/c2982db8a2c57a3250c129c28bb395715521ec4e/qa/lib/newlib/hello.c.
>
> During debug one of the issue I've noticed was a fault related to uio
> in vfprintf.c:348: apparently uio->uio_resid was uninitialized and
> actually the patch I provided fixed the test.
> However with a different test I'm working on now, I've found that
> zeroing the structures is not enough.
> Somehow uio->uio_resid overflows there, but I wasn't able yet to
> identify why or where.
>
> Any suggestion is welcome. I supposed I've just hit an untested
> combination of configure options, but actually --enable-newlib-mb is
> the only configure option I'm using (except for prefix and target,
> obviously).
>
>
>
> Giacomo
>
>
> 2017-04-26 10:24 GMT+02:00 Corinna Vinschen <vinschen@redhat.com>:
>> On Apr 21 19:03, Giacomo Tesio wrote:
>>> Hi, during the port to Jehanne, I had issues with the uninitialized
>>> uio structure in several printing functions.
>>>
>>> The attached patch fixes them.
>>
>> I'm puzzled what problem you're solving.
>>
>> I inspected the code in question and the uio structure is always filled
>> with values for all three members before using it.  Setting uio to 0
>> in all these places looks gratuitous.
>>
>> Can you please explain what exactly you're observing and how setting
>> uio to all 0 solved this problem?
>>
>>
>> Corinna
>>
>> --
>> Corinna Vinschen
>> Cygwin Maintainer
>> Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]