[vta, trunk] don't leak uninitialized stack state into output

Paul Richard Thomas paul.richard.thomas@gmail.com
Sun Mar 1 18:49:00 GMT 2009


Alexandre,

That's verging on obvious.  OK by me.

Thanks for the patch.

Paul

On Sun, Mar 1, 2009 at 11:42 AM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Sun, Mar 1, 2009 at 7:17 AM, Alexandre Oliva <aoliva@redhat.com> wrote:
>> When building certain initializers, the Fortran front-end allocates a
>> buffer on the stack, sets up some elements of it from the source of the
>> initialization, and then proceeds to use the entire buffer to initialize
>> a larger destination.  The result is that the uninitialized portion of
>> the buffer leaks into the program output.
>>
>> I figured zero-initializing the entire buffer would often be pointless,
>> so I decided to initialize only the portion that wasn't covered by the
>> source.
>>
>> I'm pretty sure this was caught in a testsuite run with -fcompare-debug,
>> but I don't recall the exact testcase :-(
>>
>> I'm installing this in the branch.  Ok for trunk?
>
> I think zeroing the buffer completely before using it would match
> general programming style more appropriately (there's no
> XCALLOCA, but maybe using xcalloc/free would be more appropriate
> anyway in case that buffer can get large).
>
> Of course I cannot approve the patch anyway.
>
> Richard.
>
>>
>> --
>> Alexandre Oliva           http://www.lsd.ic.unicamp.br/~oliva/
>> You must be the change you wish to see in the world. -- Gandhi
>> Be Free! -- http://FSFLA.org/   FSF Latin America board member
>> Free Software Evangelist      Red Hat Brazil Compiler Engineer
>>
>>
>



-- 
The knack of flying is learning how to throw yourself at the ground and miss.
       --Hitchhikers Guide to the Galaxy



More information about the Gcc-patches mailing list