]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Avoid unsafe access to negative index in a TupleDesc.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 6 Apr 2026 18:22:17 +0000 (14:22 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 6 Apr 2026 18:22:17 +0000 (14:22 -0400)
commit07e833e3cff3da136980c7a4e30e965f825ae83c
tree4abc91b84e426024802bd807a752609a2b796683
parent963fccc09cc6b3fe6f0a6246e5af16c9d9af100d
Avoid unsafe access to negative index in a TupleDesc.

Commit aa606b931 installed a test that would reference a nonexistent
TupleDesc array entry if a system column is used in COPY FROM WHERE.
Typically this would be harmless, but with bad luck it could result
in a phony "generated columns are not supported in COPY FROM WHERE
conditions" error, and at least in principle it could cause SIGSEGV.
(Compare 570e2fcc0 which fixed the identical problem in another
place.)  Also, since c98ad086a it throws an Assert instead.

In the back branches, just guard the test to make it a safe no-op for
system columns.  Commit 21c69dc73 installed a more aggressive answer
in master.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/6f435023-8ab6-47c2-ba07-035d0c4212f9@gmail.com
Backpatch-through: 14-18
src/backend/commands/copy.c