pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Don't fail on libpq-generated error reports in ecpg_raise_backen 8+ messages / 1 participants [nested] [flat]
* pgsql: Don't fail on libpq-generated error reports in ecpg_raise_backen @ 2022-06-06 15:21 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 8+ messages in thread From: Tom Lane @ 2022-06-06 15:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't fail on libpq-generated error reports in ecpg_raise_backend(). An error PGresult generated by libpq itself, such as a report of connection loss, won't have broken-down error fields. ecpg_raise_backend() blithely assumed that PG_DIAG_MESSAGE_PRIMARY would always be present, and would end up passing a NULL string pointer to snprintf when it isn't. That would typically crash before 3779ac62d, and it would fail to provide a useful error report in any case. Best practice is to substitute PQerrorMessage(conn) in such cases, so do that. Per bug #17421 from Masayuki Hirose. Back-patch to all supported branches. Discussion: https://postgr.es/m/17421-790ff887e3188874@postgresql.org Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/6d157e7cb8d3f4aa28a9fef95c498ce8ac3c31a9 Modified Files -------------- src/interfaces/ecpg/ecpglib/error.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) ^ permalink raw reply [nested|flat] 8+ messages in thread
* pgsql: Don't fail on libpq-generated error reports in ecpg_raise_backen @ 2022-06-06 15:21 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 8+ messages in thread From: Tom Lane @ 2022-06-06 15:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't fail on libpq-generated error reports in ecpg_raise_backend(). An error PGresult generated by libpq itself, such as a report of connection loss, won't have broken-down error fields. ecpg_raise_backend() blithely assumed that PG_DIAG_MESSAGE_PRIMARY would always be present, and would end up passing a NULL string pointer to snprintf when it isn't. That would typically crash before 3779ac62d, and it would fail to provide a useful error report in any case. Best practice is to substitute PQerrorMessage(conn) in such cases, so do that. Per bug #17421 from Masayuki Hirose. Back-patch to all supported branches. Discussion: https://postgr.es/m/17421-790ff887e3188874@postgresql.org Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/a5dbca460ace7e89a607d43e206973efaee0ed19 Modified Files -------------- src/interfaces/ecpg/ecpglib/error.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) ^ permalink raw reply [nested|flat] 8+ messages in thread
* pgsql: Don't fail on libpq-generated error reports in ecpg_raise_backen @ 2022-06-06 15:21 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 8+ messages in thread From: Tom Lane @ 2022-06-06 15:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't fail on libpq-generated error reports in ecpg_raise_backend(). An error PGresult generated by libpq itself, such as a report of connection loss, won't have broken-down error fields. ecpg_raise_backend() blithely assumed that PG_DIAG_MESSAGE_PRIMARY would always be present, and would end up passing a NULL string pointer to snprintf when it isn't. That would typically crash before 3779ac62d, and it would fail to provide a useful error report in any case. Best practice is to substitute PQerrorMessage(conn) in such cases, so do that. Per bug #17421 from Masayuki Hirose. Back-patch to all supported branches. Discussion: https://postgr.es/m/17421-790ff887e3188874@postgresql.org Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/16d68007cd7400061bd499b92eb80fbb9798362c Modified Files -------------- src/interfaces/ecpg/ecpglib/error.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) ^ permalink raw reply [nested|flat] 8+ messages in thread
* pgsql: Don't fail on libpq-generated error reports in ecpg_raise_backen @ 2022-06-06 15:21 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 8+ messages in thread From: Tom Lane @ 2022-06-06 15:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't fail on libpq-generated error reports in ecpg_raise_backend(). An error PGresult generated by libpq itself, such as a report of connection loss, won't have broken-down error fields. ecpg_raise_backend() blithely assumed that PG_DIAG_MESSAGE_PRIMARY would always be present, and would end up passing a NULL string pointer to snprintf when it isn't. That would typically crash before 3779ac62d, and it would fail to provide a useful error report in any case. Best practice is to substitute PQerrorMessage(conn) in such cases, so do that. Per bug #17421 from Masayuki Hirose. Back-patch to all supported branches. Discussion: https://postgr.es/m/17421-790ff887e3188874@postgresql.org Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/02026cadbf044e1f4cec5dda1bd8ec7faeffdf6d Modified Files -------------- src/interfaces/ecpg/ecpglib/error.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) ^ permalink raw reply [nested|flat] 8+ messages in thread
* pgsql: Don't fail on libpq-generated error reports in ecpg_raise_backen @ 2022-06-06 15:21 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 8+ messages in thread From: Tom Lane @ 2022-06-06 15:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't fail on libpq-generated error reports in ecpg_raise_backend(). An error PGresult generated by libpq itself, such as a report of connection loss, won't have broken-down error fields. ecpg_raise_backend() blithely assumed that PG_DIAG_MESSAGE_PRIMARY would always be present, and would end up passing a NULL string pointer to snprintf when it isn't. That would typically crash before 3779ac62d, and it would fail to provide a useful error report in any case. Best practice is to substitute PQerrorMessage(conn) in such cases, so do that. Per bug #17421 from Masayuki Hirose. Back-patch to all supported branches. Discussion: https://postgr.es/m/17421-790ff887e3188874@postgresql.org Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/d82ed5b2f820eb643935970c6fbd11061c4393a0 Modified Files -------------- src/interfaces/ecpg/ecpglib/error.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) ^ permalink raw reply [nested|flat] 8+ messages in thread
* pgsql: Don't fail on libpq-generated error reports in ecpg_raise_backen @ 2022-06-06 15:21 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 8+ messages in thread From: Tom Lane @ 2022-06-06 15:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't fail on libpq-generated error reports in ecpg_raise_backend(). An error PGresult generated by libpq itself, such as a report of connection loss, won't have broken-down error fields. ecpg_raise_backend() blithely assumed that PG_DIAG_MESSAGE_PRIMARY would always be present, and would end up passing a NULL string pointer to snprintf when it isn't. That would typically crash before 3779ac62d, and it would fail to provide a useful error report in any case. Best practice is to substitute PQerrorMessage(conn) in such cases, so do that. Per bug #17421 from Masayuki Hirose. Back-patch to all supported branches. Discussion: https://postgr.es/m/17421-790ff887e3188874@postgresql.org Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/89254606b61e36b82930c509326d46b72e003545 Modified Files -------------- src/interfaces/ecpg/ecpglib/error.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) ^ permalink raw reply [nested|flat] 8+ messages in thread
* pgsql: Don't fail on libpq-generated error reports in pg_amcheck. @ 2022-06-06 15:27 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 8+ messages in thread From: Tom Lane @ 2022-06-06 15:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't fail on libpq-generated error reports in pg_amcheck. An error PGresult generated by libpq itself, such as a report of connection loss, won't have broken-down error fields. should_processing_continue() blithely assumed that PG_DIAG_SEVERITY_NONLOCALIZED would always be present, and would dump core if it wasn't. Per grepping to see if 6d157e7cb's mistake was repeated elsewhere. Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/51da231597a9e414174cf621b219559e18269dc3 Modified Files -------------- src/bin/pg_amcheck/pg_amcheck.c | 2 ++ 1 file changed, 2 insertions(+) ^ permalink raw reply [nested|flat] 8+ messages in thread
* pgsql: Don't fail on libpq-generated error reports in pg_amcheck. @ 2022-06-06 15:27 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 8+ messages in thread From: Tom Lane @ 2022-06-06 15:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Don't fail on libpq-generated error reports in pg_amcheck. An error PGresult generated by libpq itself, such as a report of connection loss, won't have broken-down error fields. should_processing_continue() blithely assumed that PG_DIAG_SEVERITY_NONLOCALIZED would always be present, and would dump core if it wasn't. Per grepping to see if 6d157e7cb's mistake was repeated elsewhere. Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/32a85ee46b034be7b8bf8f31b24cf6fe3684fe7f Modified Files -------------- src/bin/pg_amcheck/pg_amcheck.c | 2 ++ 1 file changed, 2 insertions(+) ^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2022-06-06 15:27 UTC | newest] Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2022-06-06 15:21 pgsql: Don't fail on libpq-generated error reports in ecpg_raise_backen Tom Lane <tgl@sss.pgh.pa.us> 2022-06-06 15:21 pgsql: Don't fail on libpq-generated error reports in ecpg_raise_backen Tom Lane <tgl@sss.pgh.pa.us> 2022-06-06 15:21 pgsql: Don't fail on libpq-generated error reports in ecpg_raise_backen Tom Lane <tgl@sss.pgh.pa.us> 2022-06-06 15:21 pgsql: Don't fail on libpq-generated error reports in ecpg_raise_backen Tom Lane <tgl@sss.pgh.pa.us> 2022-06-06 15:21 pgsql: Don't fail on libpq-generated error reports in ecpg_raise_backen Tom Lane <tgl@sss.pgh.pa.us> 2022-06-06 15:21 pgsql: Don't fail on libpq-generated error reports in ecpg_raise_backen Tom Lane <tgl@sss.pgh.pa.us> 2022-06-06 15:27 pgsql: Don't fail on libpq-generated error reports in pg_amcheck. Tom Lane <tgl@sss.pgh.pa.us> 2022-06-06 15:27 pgsql: Don't fail on libpq-generated error reports in pg_amcheck. Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox