[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Zeroing stack variables CValue

From: Thomas Preudhomme
Subject: Re: [Tinycc-devel] Zeroing stack variables CValue
Date: Thu, 27 Mar 2014 23:44:17 +0800
User-agent: Roundcube Webmail/0.7.2

Le 2014-03-27 07:23, Domingo Alvarez Duarte a écrit :
Again my mistake, it does pass vla tests on linux 32 bits, the bounds
check tests fail with garbage being passed to strlen.
On arm it also works.

Hi Domingo,

I took a look at your patch and although I agree there is some problems, I find the approach a bit intrusive. For instance, in the vset case instead of zeroing the cval it would be better to fix the places that read the .ull field when it was initialized with vset. Normally a code would check the type before reading .ull and any caller of vset should do the right thing if the type needs to use the .ull field.

There is also get_tok_str that would require fixing as (as was pointed out by mobi phil) many caller of that function gives NULL as second parameter. It would be easily fixed with:

CValue cval;

if (!cv) {
    cval.ull = 0;
    cv = &cval;

The only place that should be fixed is when a variable is read but not initialized. When the wrong field of an union is read, either another field should be read or another field should have been set. Also, if tcc was used some day to compile on a big endian system the zeroing would also lead to garbage being read (only on little endian does it have no impact).

By the way, I'll try my best to take a look at your patch after the release. We'll then figure out how to best merge it. Maybe it's better in one big commit, I need to look at it first. I guess vtop, tok and tok are the biggest reason to have TCCState sneak in all function prototype, is that it?

Best regards,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]