Re: [Bug] Heap use-after-free in COPY FROM error context after ON_ERROR ignore skips a row

From: Gowdham M <gowdham(dot)m(at)zohocorp(dot)com>
To: "shihao zhong" <zhong950419(at)gmail(dot)com>
Cc: "pgsql-bugs" <pgsql-bugs(at)lists(dot)postgresql(dot)org>, "zlabs-cstore(at)zohocorp(dot)com" <zlabs-cstore(at)zohocorp(dot)com>
Subject: Re: [Bug] Heap use-after-free in COPY FROM error context after ON_ERROR ignore skips a row
Date: 2026-11-03 06:50:33
Message-ID: 1a1a02c8095.1d0cc1ef1834.3246685166635259608@zohocorp.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Shihao,

Thanks for testing, and for confirming the release-build crash.

Yes, set_null hits the same stale pointer, and the patch fixes it, since the

fields are cleared before each new line is read. Your test passes with the

patch on REL_19_STABLE and master, and fails without it, so it can go on top

of the patch for 19 and master.

Thanks & Regards,

Gowdham M

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: "Gowdham M"<gowdham(dot)m(at)zohocorp(dot)com>
Cc: "pgsql-bugs"<pgsql-bugs(at)lists(dot)postgresql(dot)org>, "zlabs-cstore(at)zohocorp(dot)com"<zlabs-cstore(at)zohocorp(dot)com>
Date: Tue, 03 Nov 2026 09:10:47 +0530
Subject: Re: [Bug] Heap use-after-free in COPY FROM error context after ON_ERROR ignore skips a row

Hi Gowdham,

Thanks for the report and the patch. I can reproduce it on 17 through
master. It also crashes a normal release build on Linux, if the next
row is a few MB long.

I think ON_ERROR set_null in 19 hits the same bug, the attached test

is a repro for it.

Thanks,

Shihao

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2026-11-03 07:46:52 BUG #19829: BTREE pivot tuple length overflows t_info when BLCKSZ=32768
Previous Message Venu K 2026-11-03 05:23:49 Re: BUG #19826: corr()/regr_r2() of constant input: NULL serially, 1 with partial aggregation