RE: [BUG] Uninitializaed configOut.leafType used.

Поиск
Список
Период
Сортировка
От Ranier Vilela
Тема RE: [BUG] Uninitializaed configOut.leafType used.
Дата
Msg-id MN2PR18MB29278BBF41FBAD99627BA1C6E3760@MN2PR18MB2927.namprd18.prod.outlook.com
обсуждение исходный текст
Ответ на Re: [BUG] Uninitializaed configOut.leafType used.  (Andres Freund <andres@anarazel.de>)
Ответы Re: [BUG] Uninitializaed configOut.leafType used.  (Andres Freund <andres@anarazel.de>)
Список pgsql-bugs
Hi,
Now we have a technical explanation, which explains the problem.
And not a judgment about knowledge.

Let's hope that always SPGIST_CONFIG_PROC hit first.

Best regards.
Ranier Vilela

________________________________________
De: Andres Freund <andres@anarazel.de>
Enviado: quarta-feira, 13 de novembro de 2019 18:03
Para: Ranier Vilela
Cc: pgsql-bugs@lists.postgresql.org
Assunto: Re: [BUG] Uninitializaed configOut.leafType used.

Hi,

On 2019-11-13 17:55:40 +0000, Ranier Vilela wrote:
> Ok, so all these commands are for what?

"commands"?


>                       case SPGIST_CONFIG_PROC:
>                               ok = check_amproc_signature(procform->amproc, VOIDOID, true,
>                                                                                       2, 2, INTERNALOID,
INTERNALOID);
>                               configIn.attType = procform->amproclefttype;
>                               memset(&configOut, 0, sizeof(configOut));
>
>                               OidFunctionCall2(procform->amproc,
>                                                                PointerGetDatum(&configIn),
>                                                                PointerGetDatum(&configOut));
>
>                               configOutLefttype = procform->amproclefttype;
>                               configOutRighttype = procform->amprocrighttype;
>
>                               /*
>                                * When leaf and attribute types are the same, compress
>                                * function is not required and we set corresponding bit in
>                                * functionset for later group consistency check.
>                                */
>                               if (!OidIsValid(configOut.leafType) ||
>                                       configOut.leafType == configIn.attType)
>                               {
>
> When case SPGIST_CONFIG_PROC, OidIsValid(configOut.leafType) is tested,
> but when case SPGIST_COMPRESS_PROC is fired, OidIsValid(configOut.leafType) is not necessary and configOut.leafType
> happy accessed?

Even if that were a problem - and I don't see why - that'd still not
make configOut.leafType be uninitialized. The SPGIST_CONFIG_PROC case is
always hit before SPGIST_COMPRESS_PROC, therefore configOut is always
initialized (c.f. memset(0) and the call to amproc to initialize the
contents).

And the OidIsValid() call is about whether a leafType is set or not, the
call to check_amproc_signature() doesn't need that.


- Andres



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #16112: large, unexpected memory consumption
Следующее
От: Andres Freund
Дата:
Сообщение: Re: [BUG] Uninitializaed configOut.leafType used.