agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Add missing connection validation in ECPG
6+ messages / 1 participants
[nested] [flat]

* pgsql: Add missing connection validation in ECPG
@ 2026-05-01 19:18  Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 0 replies; 6+ messages in thread

From: Andrew Dunstan @ 2026-05-01 19:18 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Add missing connection validation in ECPG

ECPGdeallocate_all(), ECPGprepared_statement(), ECPGget_desc(), and
ecpg_freeStmtCacheEntry() could crash with a SIGSEGV when called
without an established connection (for example, when EXEC SQL CONNECT
was forgotten or a non-existent connection name was used), because
they dereferenced the result of ecpg_get_connection() without first
checking it for NULL.

Each site is fixed in the style of the surrounding code.

New tests are added for these conditions.

Author: Shruthi Gowda <gowdashru@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Mahendra Singh Thalor <mahi6run@gmail.com>
Reviewed-by: Nishant Sharma <nishant.sharma@enterprisedb.com>
Discussion: https://postgr.es/m/3007317.1765210195@sss.pgh.pa.us
Backpatch-through: 14

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c34a280c85b39b6e875afa56542a055d2b90b640

Modified Files
--------------
src/interfaces/ecpg/ecpglib/descriptor.c           |  12 +-
src/interfaces/ecpg/ecpglib/prepare.c              |  32 +++--
src/interfaces/ecpg/test/connect/.gitignore        |   2 +
src/interfaces/ecpg/test/connect/Makefile          |   3 +-
src/interfaces/ecpg/test/connect/meson.build       |   1 +
src/interfaces/ecpg/test/connect/test6.pgc         |  68 ++++++++++
src/interfaces/ecpg/test/ecpg_schedule             |   1 +
src/interfaces/ecpg/test/expected/connect-test6.c  | 146 +++++++++++++++++++++
.../ecpg/test/expected/connect-test6.stderr        |  50 +++++++
.../ecpg/test/expected/connect-test6.stdout        |   9 ++
10 files changed, 312 insertions(+), 12 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Add missing connection validation in ECPG
@ 2026-05-01 19:18  Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 0 replies; 6+ messages in thread

From: Andrew Dunstan @ 2026-05-01 19:18 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Add missing connection validation in ECPG

ECPGdeallocate_all(), ECPGprepared_statement(), ECPGget_desc(), and
ecpg_freeStmtCacheEntry() could crash with a SIGSEGV when called
without an established connection (for example, when EXEC SQL CONNECT
was forgotten or a non-existent connection name was used), because
they dereferenced the result of ecpg_get_connection() without first
checking it for NULL.

Each site is fixed in the style of the surrounding code.

New tests are added for these conditions.

Author: Shruthi Gowda <gowdashru@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Mahendra Singh Thalor <mahi6run@gmail.com>
Reviewed-by: Nishant Sharma <nishant.sharma@enterprisedb.com>
Discussion: https://postgr.es/m/3007317.1765210195@sss.pgh.pa.us
Backpatch-through: 14

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e2688ea5e411e3ff995c95dd207d1e1911142b8a

Modified Files
--------------
src/interfaces/ecpg/ecpglib/descriptor.c           |  12 +-
src/interfaces/ecpg/ecpglib/prepare.c              |  32 +++--
src/interfaces/ecpg/test/connect/.gitignore        |   2 +
src/interfaces/ecpg/test/connect/Makefile          |   3 +-
src/interfaces/ecpg/test/connect/meson.build       |   1 +
src/interfaces/ecpg/test/connect/test6.pgc         |  68 ++++++++++
src/interfaces/ecpg/test/ecpg_schedule             |   1 +
src/interfaces/ecpg/test/expected/connect-test6.c  | 146 +++++++++++++++++++++
.../ecpg/test/expected/connect-test6.stderr        |  50 +++++++
.../ecpg/test/expected/connect-test6.stdout        |   9 ++
10 files changed, 312 insertions(+), 12 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Add missing connection validation in ECPG
@ 2026-05-01 19:18  Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 0 replies; 6+ messages in thread

From: Andrew Dunstan @ 2026-05-01 19:18 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Add missing connection validation in ECPG

ECPGdeallocate_all(), ECPGprepared_statement(), ECPGget_desc(), and
ecpg_freeStmtCacheEntry() could crash with a SIGSEGV when called
without an established connection (for example, when EXEC SQL CONNECT
was forgotten or a non-existent connection name was used), because
they dereferenced the result of ecpg_get_connection() without first
checking it for NULL.

Each site is fixed in the style of the surrounding code.

New tests are added for these conditions.

Author: Shruthi Gowda <gowdashru@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Mahendra Singh Thalor <mahi6run@gmail.com>
Reviewed-by: Nishant Sharma <nishant.sharma@enterprisedb.com>
Discussion: https://postgr.es/m/3007317.1765210195@sss.pgh.pa.us
Backpatch-through: 14

Branch
------
REL_17_STABLE

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

Modified Files
--------------
src/interfaces/ecpg/ecpglib/descriptor.c           |  12 +-
src/interfaces/ecpg/ecpglib/prepare.c              |  32 +++--
src/interfaces/ecpg/test/connect/.gitignore        |   2 +
src/interfaces/ecpg/test/connect/Makefile          |   3 +-
src/interfaces/ecpg/test/connect/meson.build       |   1 +
src/interfaces/ecpg/test/connect/test6.pgc         |  68 ++++++++++
src/interfaces/ecpg/test/ecpg_schedule             |   1 +
src/interfaces/ecpg/test/expected/connect-test6.c  | 146 +++++++++++++++++++++
.../ecpg/test/expected/connect-test6.stderr        |  50 +++++++
.../ecpg/test/expected/connect-test6.stdout        |   9 ++
10 files changed, 312 insertions(+), 12 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Add missing connection validation in ECPG
@ 2026-05-01 19:18  Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 0 replies; 6+ messages in thread

From: Andrew Dunstan @ 2026-05-01 19:18 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Add missing connection validation in ECPG

ECPGdeallocate_all(), ECPGprepared_statement(), ECPGget_desc(), and
ecpg_freeStmtCacheEntry() could crash with a SIGSEGV when called
without an established connection (for example, when EXEC SQL CONNECT
was forgotten or a non-existent connection name was used), because
they dereferenced the result of ecpg_get_connection() without first
checking it for NULL.

Each site is fixed in the style of the surrounding code.

New tests are added for these conditions.

Author: Shruthi Gowda <gowdashru@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Mahendra Singh Thalor <mahi6run@gmail.com>
Reviewed-by: Nishant Sharma <nishant.sharma@enterprisedb.com>
Discussion: https://postgr.es/m/3007317.1765210195@sss.pgh.pa.us
Backpatch-through: 14

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7e4c871f41814ebc694cebd544afee5c5a172e0e

Modified Files
--------------
src/interfaces/ecpg/ecpglib/descriptor.c           |  12 +-
src/interfaces/ecpg/ecpglib/prepare.c              |  32 +++--
src/interfaces/ecpg/test/connect/.gitignore        |   2 +
src/interfaces/ecpg/test/connect/Makefile          |   3 +-
src/interfaces/ecpg/test/connect/meson.build       |   1 +
src/interfaces/ecpg/test/connect/test6.pgc         |  68 ++++++++++
src/interfaces/ecpg/test/ecpg_schedule             |   1 +
src/interfaces/ecpg/test/expected/connect-test6.c  | 146 +++++++++++++++++++++
.../ecpg/test/expected/connect-test6.stderr        |  50 +++++++
.../ecpg/test/expected/connect-test6.stdout        |   9 ++
10 files changed, 312 insertions(+), 12 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Add missing connection validation in ECPG
@ 2026-05-01 19:18  Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 0 replies; 6+ messages in thread

From: Andrew Dunstan @ 2026-05-01 19:18 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Add missing connection validation in ECPG

ECPGdeallocate_all(), ECPGprepared_statement(), ECPGget_desc(), and
ecpg_freeStmtCacheEntry() could crash with a SIGSEGV when called
without an established connection (for example, when EXEC SQL CONNECT
was forgotten or a non-existent connection name was used), because
they dereferenced the result of ecpg_get_connection() without first
checking it for NULL.

Each site is fixed in the style of the surrounding code.

New tests are added for these conditions.

Author: Shruthi Gowda <gowdashru@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Mahendra Singh Thalor <mahi6run@gmail.com>
Reviewed-by: Nishant Sharma <nishant.sharma@enterprisedb.com>
Discussion: https://postgr.es/m/3007317.1765210195@sss.pgh.pa.us
Backpatch-through: 14

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6916f44100515b7d939f034a2c78caef4047209e

Modified Files
--------------
src/interfaces/ecpg/ecpglib/descriptor.c           |  12 +-
src/interfaces/ecpg/ecpglib/prepare.c              |  32 +++--
src/interfaces/ecpg/test/connect/.gitignore        |   2 +
src/interfaces/ecpg/test/connect/Makefile          |   3 +-
src/interfaces/ecpg/test/connect/test6.pgc         |  68 ++++++++++
src/interfaces/ecpg/test/ecpg_schedule             |   1 +
src/interfaces/ecpg/test/expected/connect-test6.c  | 146 +++++++++++++++++++++
.../ecpg/test/expected/connect-test6.stderr        |  50 +++++++
.../ecpg/test/expected/connect-test6.stdout        |   9 ++
9 files changed, 311 insertions(+), 12 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Add missing connection validation in ECPG
@ 2026-05-01 19:18  Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 0 replies; 6+ messages in thread

From: Andrew Dunstan @ 2026-05-01 19:18 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Add missing connection validation in ECPG

ECPGdeallocate_all(), ECPGprepared_statement(), ECPGget_desc(), and
ecpg_freeStmtCacheEntry() could crash with a SIGSEGV when called
without an established connection (for example, when EXEC SQL CONNECT
was forgotten or a non-existent connection name was used), because
they dereferenced the result of ecpg_get_connection() without first
checking it for NULL.

Each site is fixed in the style of the surrounding code.

New tests are added for these conditions.

Author: Shruthi Gowda <gowdashru@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Mahendra Singh Thalor <mahi6run@gmail.com>
Reviewed-by: Nishant Sharma <nishant.sharma@enterprisedb.com>
Discussion: https://postgr.es/m/3007317.1765210195@sss.pgh.pa.us
Backpatch-through: 14

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/f0e3f9732d41e0f6f902280fd3b117af272d7adc

Modified Files
--------------
src/interfaces/ecpg/ecpglib/descriptor.c           |  12 +-
src/interfaces/ecpg/ecpglib/prepare.c              |  32 +++--
src/interfaces/ecpg/test/connect/.gitignore        |   2 +
src/interfaces/ecpg/test/connect/Makefile          |   3 +-
src/interfaces/ecpg/test/connect/test6.pgc         |  68 ++++++++++
src/interfaces/ecpg/test/ecpg_schedule             |   1 +
src/interfaces/ecpg/test/expected/connect-test6.c  | 146 +++++++++++++++++++++
.../ecpg/test/expected/connect-test6.stderr        |  50 +++++++
.../ecpg/test/expected/connect-test6.stdout        |   9 ++
9 files changed, 311 insertions(+), 12 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2026-05-01 19:18 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-05-01 19:18 pgsql: Add missing connection validation in ECPG Andrew Dunstan <andrew@dunslane.net>
2026-05-01 19:18 pgsql: Add missing connection validation in ECPG Andrew Dunstan <andrew@dunslane.net>
2026-05-01 19:18 pgsql: Add missing connection validation in ECPG Andrew Dunstan <andrew@dunslane.net>
2026-05-01 19:18 pgsql: Add missing connection validation in ECPG Andrew Dunstan <andrew@dunslane.net>
2026-05-01 19:18 pgsql: Add missing connection validation in ECPG Andrew Dunstan <andrew@dunslane.net>
2026-05-01 19:18 pgsql: Add missing connection validation in ECPG Andrew Dunstan <andrew@dunslane.net>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox