pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Evgeniy Gorbanev <gorbanyoves@basealt.ru>
Cc: Daniel Gustafsson <daniel@yesql.se>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: No error checking when reading from file using zstd in pg_dump
Date: Mon, 16 Jun 2025 09:56:06 -0400
Message-ID: <517794.1750082166@sss.pgh.pa.us> (raw)
In-Reply-To: <e2b7edd1-c5b8-484d-9c79-7a7c4466fad2@basealt.ru>
References: <6b9817a8-88ec-4efd-b441-9e2a0439c6b8@basealt.ru>
	<C22FF2A1-783D-4334-998B-2D4432EFD7C5@yesql.se>
	<95255a86-4bc7-4ff4-aa26-4441aafdf0fb@basealt.ru>
	<522DB522-3962-4F91-A691-2DE790F6CCD6@yesql.se>
	<b653a2f4-1dcb-45ba-b899-fc6aa80794f2@basealt.ru>
	<D38B293E-E886-4F0D-BD5A-C958DCB2344C@yesql.se>
	<e2b7edd1-c5b8-484d-9c79-7a7c4466fad2@basealt.ru>

I think the real problem here is that what the code is doing is
precisely not what is documented in compress_io.h:

    /*
     * Read 'size' bytes of data from the file and store them into 'ptr'.
     * Optionally it will store the number of bytes read in 'rsize'.
     *
     * Returns true on success and throws an internal error otherwise.
     */
    bool        (*read_func) (void *ptr, size_t size, size_t *rsize,
                              CompressFileHandle *CFH);

I've not checked to see what the other users of this API do, but
if they're all like this then we need to fix that comment.
Otherwise we probably need to make them all alike; even if there's
not a bug today, one will soon appear from someone believing the
comment.

			regards, tom lane





view thread (29+ messages)  latest in thread

Message-ID: <517794.1750082166@sss.pgh.pa.us>
Permalink:  ../517794.1750082166@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/517794.1750082166@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-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, gorbanyoves@basealt.ru, daniel@yesql.se, pgsql-hackers@lists.postgresql.org
  Subject: Re: No error checking when reading from file using zstd in pg_dump
  In-Reply-To: <517794.1750082166@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