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

Richard Kettlewell rjk at greenend.org.uk
Mon Jun 22 19:37:34 UTC 2015


On 22/06/15 19:27, Julien ÉLIE wrote:
>> --- 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!

> "-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...

>>     1. memchr can't tolerate a null pointer argument (even for 0 bytes)
>>
>> --- a/lib/buffer.c
>> +++ b/lib/buffer.c
>> @@ -245,6 +245,8 @@ buffer_find_string(struct buffer *buffer, const char *string, size_t start,
>>      length = strlen(string);
>>      do {
>>          data = buffer->data + buffer->used + start;
>> +        if(!data)
>> +            return false;
>>          terminator = memchr(data, string[0], buffer->left - start);
>>          if (terminator == NULL)
>>              return false;
> 
> This patch is related to an external library we use (rra-c-util).  It will
> be merged into INN when and if Russ takes it into account in a future release
> of rra-c-util.

OK

ttfn/rjk



More information about the inn-workers mailing list