pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix use-after-free in COPY (ON_ERROR)
4+ messages / 1 participants
[nested] [flat]

* pgsql: Fix use-after-free in COPY (ON_ERROR)
@ 2026-11-06 00:19 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 4+ messages in thread

From: Michael Paquier @ 2026-11-06 00:19 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix use-after-free in COPY (ON_ERROR)

When ON_ERROR handled a soft error, some of the contents set for the
error context callback could remain set and pointing at areas that could
be reset, leading to some use-after-frees depending on the input data
provided through COPY.

These contents are now reset at the beginning of NextCopyFrom(), before
processing the next tuple.

SET_NULL is affected down to v19, IGNORE down to v17.

Author: Gowdham M <gowdham.m@zohocorp.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Shihao Zhong <zhong950419@gmail.com>
Discussion: https://postgr.es/m/1a181ff6be8.6d14feb261368.4036709598649280477@zohocorp.com
Backpatch-through: 17

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/23e2a332dd24c6b67f4a9bdbb3e0dbdb0a527156

Modified Files
--------------
src/backend/commands/copyfromparse.c |  4 ++++
src/test/regress/expected/copy2.out  |  8 ++++++++
src/test/regress/sql/copy2.sql       | 11 +++++++++++
3 files changed, 23 insertions(+)



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

* pgsql: Fix use-after-free in COPY (ON_ERROR)
@ 2026-11-06 00:19 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 4+ messages in thread

From: Michael Paquier @ 2026-11-06 00:19 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix use-after-free in COPY (ON_ERROR)

When ON_ERROR handled a soft error, some of the contents set for the
error context callback could remain set and pointing at areas that could
be reset, leading to some use-after-frees depending on the input data
provided through COPY.

These contents are now reset at the beginning of NextCopyFrom(), before
processing the next tuple.

SET_NULL is affected down to v19, IGNORE down to v17.

Author: Gowdham M <gowdham.m@zohocorp.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Shihao Zhong <zhong950419@gmail.com>
Discussion: https://postgr.es/m/1a181ff6be8.6d14feb261368.4036709598649280477@zohocorp.com
Backpatch-through: 17

Branch
------
REL_19_STABLE

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

Modified Files
--------------
src/backend/commands/copyfromparse.c |  4 ++++
src/test/regress/expected/copy2.out  |  8 ++++++++
src/test/regress/sql/copy2.sql       | 11 +++++++++++
3 files changed, 23 insertions(+)



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

* pgsql: Fix use-after-free in COPY (ON_ERROR)
@ 2026-11-06 00:19 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 4+ messages in thread

From: Michael Paquier @ 2026-11-06 00:19 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix use-after-free in COPY (ON_ERROR)

When ON_ERROR handled a soft error, some of the contents set for the
error context callback could remain set and pointing at areas that could
be reset, leading to some use-after-frees depending on the input data
provided through COPY.

These contents are now reset at the beginning of NextCopyFrom(), before
processing the next tuple.

SET_NULL is affected down to v19, IGNORE down to v17.

Author: Gowdham M <gowdham.m@zohocorp.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Shihao Zhong <zhong950419@gmail.com>
Discussion: https://postgr.es/m/1a181ff6be8.6d14feb261368.4036709598649280477@zohocorp.com
Backpatch-through: 17

Branch
------
REL_18_STABLE

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

Modified Files
--------------
src/backend/commands/copyfromparse.c | 4 ++++
src/test/regress/expected/copy2.out  | 4 ++++
src/test/regress/sql/copy2.sql       | 6 ++++++
3 files changed, 14 insertions(+)



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

* pgsql: Fix use-after-free in COPY (ON_ERROR)
@ 2026-11-06 00:19 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 4+ messages in thread

From: Michael Paquier @ 2026-11-06 00:19 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix use-after-free in COPY (ON_ERROR)

When ON_ERROR handled a soft error, some of the contents set for the
error context callback could remain set and pointing at areas that could
be reset, leading to some use-after-frees depending on the input data
provided through COPY.

These contents are now reset at the beginning of NextCopyFrom(), before
processing the next tuple.

SET_NULL is affected down to v19, IGNORE down to v17.

Author: Gowdham M <gowdham.m@zohocorp.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Shihao Zhong <zhong950419@gmail.com>
Discussion: https://postgr.es/m/1a181ff6be8.6d14feb261368.4036709598649280477@zohocorp.com
Backpatch-through: 17

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/61b06d2ba61d04398585d6d06b1ee5f4cd53c3b5

Modified Files
--------------
src/backend/commands/copyfromparse.c | 4 ++++
src/test/regress/expected/copy2.out  | 4 ++++
src/test/regress/sql/copy2.sql       | 6 ++++++
3 files changed, 14 insertions(+)



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


end of thread, other threads:[~2026-11-06 00:19 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-06 00:19 pgsql: Fix use-after-free in COPY (ON_ERROR) Michael Paquier <michael@paquier.xyz>
2026-11-06 00:19 pgsql: Fix use-after-free in COPY (ON_ERROR) Michael Paquier <michael@paquier.xyz>
2026-11-06 00:19 pgsql: Fix use-after-free in COPY (ON_ERROR) Michael Paquier <michael@paquier.xyz>
2026-11-06 00:19 pgsql: Fix use-after-free in COPY (ON_ERROR) Michael Paquier <michael@paquier.xyz>

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