pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Justin Pryzby <pryzby@telsasoft.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Sergey KOPOSOV <Sergey.Koposov@ed.ac.uk>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16951: pg_restore segfaults on custom format piped from a different version of PG
Date: Thu, 1 Apr 2021 12:56:34 -0500
Message-ID: <20210401175634.GI4431@telsasoft.com> (raw)
In-Reply-To: <3413025.1617291573@sss.pgh.pa.us>
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>
	<3413025.1617291573@sss.pgh.pa.us>

On Thu, Apr 01, 2021 at 11:39:33AM -0400, Tom Lane wrote:
> 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!

Yes, thank you both.  I've run into this recently but for some reason I thought
it was fixed.  It probably also explains this one from 2014.
https://www.postgresql.org/message-id/20141206061151.GA725@telsasoft.com

-- 
Justin





view thread (9+ messages)  latest in thread

Message-ID: <20210401175634.GI4431@telsasoft.com>
Permalink:  ../20210401175634.GI4431@telsasoft.com/
Also on:    postgresql.org/message-id/20210401175634.GI4431@telsasoft.com

 · 

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: pryzby@telsasoft.com, 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: <20210401175634.GI4431@telsasoft.com>

* 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