Re: Fix use of possible uninitialized variable retval (src/pl/plpgsql/src/pl_handler.c)

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fix use of possible uninitialized variable retval (src/pl/plpgsql/src/pl_handler.c)
Date: 2024-06-05 12:28:05
Message-ID: CAEudQAr8X==65be_kNyLhL4p9DjNjMOwT=Vo5MZJGFpT8yeAmw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em qua., 5 de jun. de 2024 às 01:12, Kyotaro Horiguchi <
horikyota(dot)ntt(at)gmail(dot)com> escreveu:

> At Mon, 27 May 2024 11:31:24 -0300, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
> wrote in
> > Hi.
> >
> > The function *plpgsql_inline_handler* can use uninitialized
> > variable retval, if PG_TRY fails.
> > Fix like function*plpgsql_call_handler* wich declare retval as
> > volatile and initialize to (Datum 0).
>
> If PG_TRY fails, retval is not actually accessed, so no real issue
> exists.

You say it for this call
PG_RE_THROW();

> Commit 7292fd8f1c changed plpgsql_call_handler() to the
> current form, but as stated in its commit message, it did not fix a
> real issue and was solely to silence compiler.
>

> I believe we do not need to modify plpgsql_inline_handler() unless
> compiler actually issues a false warning for it.
>
Yeah, there is a warning, but not from the compiler.

best regards,
Ranier Vilela

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2024-06-05 12:30:38 Re: Logical Replication of sequences
Previous Message Jelte Fennema-Nio 2024-06-05 11:52:59 libpq: Trace StartupMessage/SSLRequest/GSSENCRequest correctly