Re: Prevent invalid memory access in LookupFuncName - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Prevent invalid memory access in LookupFuncName
Date
Msg-id 20190625021956.GE5569@paquier.xyz
Whole thread Raw
In response to Prevent invalid memory access in LookupFuncName  (Alexander Lakhin <exclusion@gmail.com>)
List pgsql-hackers
On Mon, Jun 24, 2019 at 11:10:54PM +0300, Alexander Lakhin wrote:
> When running on REL_11_STABLE the following query:
> CREATE PROCEDURE test_ambiguous_procname(int) as $$ begin end; $$
> language plpgsql;
> CREATE PROCEDURE test_ambiguous_procname(text) as $$ begin end; $$
> language plpgsql;
> DROP PROCEDURE test_ambiguous_procname;
> under valgrind I get the memory access errors:

Thanks!  I have been able to reproduce the problem, and the error is
obvious looking at the code.  I have changed the patch to be more
consistent with HEAD though, returning InvalidOid in the code paths
generating the error.  The logic is the same, but that looked cleaner
to me, and I have added some comments on the way, similarly to what
bfb456c1 has done for HEAD (where LookupFuncNameInternal is doing the
right thing already).  This has been incorrect since aefeb68, so
back-patched down to 10.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Daniel Wood
Date:
Subject: pgbench prints suspect tps numbers
Next
From: Thomas Munro
Date:
Subject: Re: old_snapshot_threshold vs indexes