Re: [HACKERS] Small fix: avoid passing null pointers to memcpy()

Поиск
Список
Период
Сортировка
От didier
Тема Re: [HACKERS] Small fix: avoid passing null pointers to memcpy()
Дата
Msg-id CAJRYxu+5wNP8JcxbvE4hzB47vHO4XQxbxG5ZFbZ5ADe78p_gOg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] Small fix: avoid passing null pointers to memcpy()  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

On Fri, May 24, 2019 at 5:10 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> didier <did447@gmail.com> writes:
> > A smaller version removing memset in print_aligned_text function.
> > The line is redundant , header_done isn't used yet and it's either
> > pg_malloc0 or null.
>
> Hm, I see the theoretical problem ...
>
> > Without this patch make check fails 3 tests if pg is compiled with
> > -fsanitize=address,undefined
>
> ... but if that's the only evidence of an actual problem, I can't
> get excited about it.  ASAN complains about many things in Postgres,
Not that much, make check has only this one.

> and most of them are pretty hypothetical.
Well there's no point for this line even without ASAN, why call memset
on header_done but not on width_header,
width_average, and so on?

ASAN complaining at runtime because memset is called with a null ptr
and a zero count is just the nudge for removing it.

Regards
Didier



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Runtime Partition Pruning
Следующее
От: Andres Freund
Дата:
Сообщение: Re: [HACKERS] Runtime Partition Pruning