Re: BUG #16951: pg_restore segfaults on custom format piped from a different version of PG
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Sergey KOPOSOV <Sergey.Koposov@ed.ac.uk>
Cc: "pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>
Date: 2021-04-01T15:39:33Z
Lists: pgsql-bugs
Sergey KOPOSOV <Sergey.Koposov@ed.ac.uk> writes: > Importantly This requires running pg_restore without '-Fc' flag, i.e. to let it autodetect. > $ cat /tmp/xx1.short | ./src/bin/pg_dump/pg_restore > Segmentation fault (core dumped) > $ cat /tmp/xx1.short | ./src/bin/pg_dump/pg_restore -Fc > pg_restore: [archiver] unsupported version (1.14) in file header Ooooh ... the autodetect + cant-seek code path is just broken. All of the sanity checks on the first few fields of the file --- particularly the version number --- just get skipped in this scenario. I wonder why it's a good idea to read-ahead any of those fields in the first place. Checking the PGDMP magic string seems sufficient. Will fix, thanks for the report! regards, tom lane
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix pg_restore's misdesigned code for detecting archive file format.
- ec03f2df17a8 14.0 landed
- 84c5e0dd2e73 12.7 landed
- 35421a470de1 13.3 landed
- 2c9b857afbcf 9.6.22 landed
- 25fe401d5350 11.12 landed
- 1b6961c8fec8 10.17 landed