pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
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>
Subject: Re: BUG #16951: pg_restore segfaults on custom format piped from a different version of PG
Date: Thu, 01 Apr 2021 11:39:33 -0400
Message-ID: <3413025.1617291573@sss.pgh.pa.us> (raw)
In-Reply-To: <51cec7215378e9beccb9b58831f6e0a2be30bd06.camel@ed.ac.uk>
References: <16951-a4dd68cf0de23048@postgresql.org>
	<3331060.1617226031@sss.pgh.pa.us>
	<5d848bddbb3b6421af5a742e36ede542e719c492.camel@ed.ac.uk>
	<3338139.1617230824@sss.pgh.pa.us>
	<d8930bce790cbe14f5efed8d5d42f296a1fe54fe.camel@ed.ac.uk>
	<51cec7215378e9beccb9b58831f6e0a2be30bd06.camel@ed.ac.uk>

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





view thread (9+ messages)  latest in thread

Message-ID: <3413025.1617291573@sss.pgh.pa.us>
Permalink:  ../3413025.1617291573@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3413025.1617291573@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, Sergey.Koposov@ed.ac.uk, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #16951: pg_restore segfaults on custom format piped from a different version of PG
  In-Reply-To: <3413025.1617291573@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox