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 <[email protected]> Reviewed-by: Michael Paquier <[email protected]> Reviewed-by: Shihao Zhong <[email protected]> Discussion: https://postgr.es/m/[email protected] 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(+)
