| From: | Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com> |
|---|---|
| To: | Andrey Borodin <x4mmm(at)yandex-team(dot)ru> |
| Cc: | ilia(dot)kashintsev(at)gmail(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: BUG #19613: pg_restore: several SEGVs in ReadToc() in pg_backup_archiver.c |
| Date: | 2026-08-14 13:59:45 |
| Message-ID: | CAB8bMitfbp9pD_7CLxfWHhHDWj3JQicfPKayGWKqoHgcchf9SA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
пт, 14 авг. 2026 г. в 16:58, Andrey Borodin <x4mmm(at)yandex-team(dot)ru>:
> Could we add a regression test? The reporter's reproducer is short and
> looks cool, needs no server, and could fit naturally in t/001_basic.pl. A
> command_fails_like() check for the new "missing table OID in TOC" error
> would prove that the original crash is fixed and protect the new helper.
>
> It might be worth covering the other four call sites too, but I would
> consider the original reproducer sufficient for this patch.
>
Hi Andrey!
Thanks for the review.
I added a regression test, attached as v2. It goes into
src/bin/pg_dump/t/001_basic.pl next to the other checks that need no
server. Rather than just the reporter's reproducer, it now covers every
ReadRequiredStr() call site in ReadToc(). The test builds a handful of
minimal custom-format archives, each with exactly one required TOC field
encoded as a NULL string (table OID, OID, entry tag, entry description
and the WITH OIDS marker), and uses command_fails_like() to require the
matching "missing <field> in TOC" error. The archive bytes are produced
by two tiny helpers.
The test does not depend on anything version-specific. It writes an
archive with a 1.12 header, a version every supported branch still reads,
and ReadToc() consumes those TOC fields in the same order on all of them.
The nullable fields it walks past are written as NULL, and the newer
fields (tableam, relkind) are gated on later versions and simply not
present at 1.12, so the same bytes exercise the same call sites from 14
to master. Valid archives are unaffected.
The test was checked on all releases from master to REL_14_STABLE
--
Regards,
Rachitskiy Andrey
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0001-Fix-SEGV-in-ReadToc-on-NULL-ReadStr-results.patch | text/x-patch | 6.1 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Daniel Gustafsson | 2026-08-14 14:07:58 | Re: MERGE/SPLIT PARTITIONS issues/questions |
| Previous Message | Fujii Masao | 2026-08-14 12:33:08 | Re: BUG #19616: pgoutput sends stream abort ('A') to clients that did not enable streaming |