| From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
|---|---|
| To: | Haibo Yan <tristan(dot)yim(at)gmail(dot)com> |
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com> |
| Subject: | Re: [PATCH v1] pg_stash_advice: Reject embedded NUL bytes in persistence files |
| Date: | 2026-11-17 07:25:25 |
| Message-ID: | 7010C1D7-7ADD-40F2-B00E-47074CA4F8CA@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> On Nov 17, 2026, at 10:35, Haibo Yan <tristan(dot)yim(at)gmail(dot)com> wrote:
>
> Hi hackers,
>
> The initial leads for this work came from several independent
> LLM-assisted reviews of the plan advice code. The reviews identified
> several candidate issues, which we then reproduced and checked
> individually. Several issues were confirmed.
>
> This is the first patch we are posting from that review. It addresses
> one of the confirmed issues. The remaining fixes are independent and
> will be submitted separately after their tests and reviews are
> complete.
>
> pg_stash_advice reads its persistence file into memory, but the loader
> previously parsed the buffer as a NUL-terminated string. If the file
> contained an embedded NUL byte, the loader silently treated it as the
> end of the file and accepted only the preceding records.
Hi Haibo,
Thanks for the patch.
I'm just curious why a file might contain an embedded NUL byte. Is there a known scenario where pg_stash_advice.tsv could contain a NUL byte? If that's because of file corruption, couldn't any byte appear in the middle of the file? In that case, is checking only for NUL bytes good enough?
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Stepan Neretin | 2026-11-17 07:30:10 | Re: FATAL: could not send end-of-streaming message to primary: no COPY in progress |
| Previous Message | Fujii Masao | 2026-11-17 07:15:33 | Re: Assertion failure with temporary relations in single-user mode |