RE: [PATCH][BUG_FIX] Potential null pointer dereferencing. - Mailing list pgsql-hackers

From Ranier Vilela
Subject RE: [PATCH][BUG_FIX] Potential null pointer dereferencing.
Date
Msg-id MN2PR18MB2927BC110E8BDE8A93F9945BE3770@MN2PR18MB2927.namprd18.prod.outlook.com
Whole thread Raw
In response to Re: [PATCH][BUG_FIX] Potential null pointer dereferencing.  (Daniel Gustafsson <daniel@yesql.se>)
Responses Re: [PATCH][BUG_FIX] Potential null pointer dereferencing.  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
List pgsql-hackers
Hi,
The condition is :
74.  if (TupIsNull(slot))  is true
85.  if (TupIsNull(resultTupleSlot)) is true too.

If resultTupleSlot is not can be NULL, why test if (TupIsNull(resultTupleSlot))?
Occurring these two conditions ExecClearTuple is called, but, don't check by NULL arg.

There are at least 2 more possible cases, envolving ExecClearTuple:
nodeFunctionscan.c and nodeWindowAgg.c

Best regards,
Ranier Vilela

________________________________________
De: Daniel Gustafsson <daniel@yesql.se>
Enviado: terça-feira, 12 de novembro de 2019 13:43
Para: Ranier Vilela
Cc: PostgreSQL Hackers
Assunto: Re: [PATCH][BUG_FIX] Potential null pointer dereferencing.

> On 12 Nov 2019, at 14:07, Ranier Vilela <ranier_gyn@hotmail.com> wrote:

> ExecClearTuple don't check por NULL pointer arg and according
> TupIsNull slot can be NULL.

I assume you are referring to the TupIsNull(resultTupleSlot) check a few lines
down in the same loop?  If resultTupleSlot was indeed NULL and not empty, the
subsequent call to ExecCopySlot would be a NULL pointer dereference too.  I
might be missing something obvious, but in which case can resultTupleSlot be
NULL when calling ExecUnique?

cheers ./daniel



pgsql-hackers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: [PATCH][BUG_FIX] Potential null pointer dereferencing.
Next
From: Luis Carril
Date:
Subject: Re: Option to dump foreign data in pg_dump