pgsql: Tighten test_predtest's input checks, and improve error messages

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Tighten test_predtest's input checks, and improve error messages
Date: 2024-06-07 20:46:12
Message-ID: E1sFgTT-000S5c-Rf@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Tighten test_predtest's input checks, and improve error messages.

test_predtest() neglected to consider the possibility that
SPI_plan_get_cached_plan would return NULL. This led to a core
dump if the input (incorrectly) contains more than one SQL
command.

While here, let's expend more than zero effort on the error
message for this case and nearby ones.

Per (half of) bug #18483 from Alexander Kozhemyakin.
Back-patch to all supported branches, not because this is
very significant (it's merely test scaffolding) but to make
our world a bit safer for fuzz testing.

Discussion: https://postgr.es/m/18483-30bfff42de238000@postgresql.org

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5f200ab5749a0813c48b45b217b273abeb2fdc52

Modified Files
--------------
src/test/modules/test_predtest/test_predtest.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2024-06-10 02:08:06 pgsql: Fix RBM_ZERO_AND_LOCK.
Previous Message Tom Lane 2024-06-07 18:50:25 pgsql: Reject modifying a temp table of another session with ALTER TABL