ecpg: fix more minor mishandling of bad input in preprocessor.
authorTom Lane
Thu, 17 Oct 2024 19:28:32 +0000 (15:28 -0400)
committerTom Lane
Thu, 17 Oct 2024 19:28:32 +0000 (15:28 -0400)
commit1fed234f9faf1071d925434c5e9c14688fb4c77e
treee682cc737b24251fd37c7ac366317eaa365accf6
parent98c7c7152d2d4670a349c0fe48f05cf95c0b1185
ecpg: fix more minor mishandling of bad input in preprocessor.

Don't get confused by an unmatched right brace in the input.
(Previously, this led to discarding information about file-level
variables and then possibly crashing.)

Detect, rather than crash on, an attempt to index into a non-array
variable.

As before, in the absence of field complaints I'm not too
excited about back-patching these.

Per valgrind testing by Alexander Lakhin.

Discussion: https://postgr.es/m/a239aec2-6c79-5fc9-9272-cea41158a360@gmail.com
src/interfaces/ecpg/preproc/ecpg.trailer
src/interfaces/ecpg/preproc/variable.c