Clean 'make check' against gcc -fsanitize=address,undefined

Julien ÉLIE julien at trigofacile.com
Thu Jun 25 20:20:04 UTC 2015


Hi Richard,

>>> --- a/tests/innd/artparse-t.c
>>> +++ b/tests/innd/artparse-t.c
>>> @@ -59,6 +59,7 @@ fake_innconf(void)
>>>           free(innconf);
>>>       }
>>>       innconf = xmalloc(sizeof(*innconf));
>>> +     memset(innconf, 0, sizeof *innconf);
>>>       innconf->logipaddr = false;
>>>       innconf->maxartsize = 8 * 1024;
>>>       innconf->pathetc = xstrdup("../data/etc");
>>
>> Shouldn't the same memset() line be added after the allocation
>> of innconf in the following files?
>> - tests/overview/api-t.c
>> - tests/overview/overview-t.c
>> - tests/overview/xref-t.c
>> - lib/innconf.c
>
> Wouldn't hurt!

OK, done.

Interestingly, only lib/dbz.c was initializing innconf with 0es:
innconf = xcalloc(1, sizeof(struct innconf));



>> "-fsanitize=address,undefined" did not trigger any warning for them?
>
> It didn't.  I expect they don't access the uninitialized parts of the
> structure.  Dynamic analysis can only reveal limited classes of issues...

Such accesses could be something that static analysis could find, 
though.  What has already been initialized is normally known.  At least 
for the kind of calls we do (no dynamic variable).  Isn't it strange 
that static analysis tools do not manage to catch that?

-- 
Julien ÉLIE

« Le temps, c'est des sesterces. » (Coquelus)


More information about the inn-workers mailing list