Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uRAJq-007flq-4H for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Jun 2025 13:56:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uRAJn-000Sr9-Tv for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Jun 2025 13:56:12 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uRAJn-000Sr1-KJ for pgsql-hackers@lists.postgresql.org; Mon, 16 Jun 2025 13:56:12 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uRAJm-002KDp-2A for pgsql-hackers@lists.postgresql.org; Mon, 16 Jun 2025 13:56:11 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 55GDu6Fp517795; Mon, 16 Jun 2025 09:56:06 -0400 From: Tom Lane To: Evgeniy Gorbanev cc: Daniel Gustafsson , pgsql-hackers@lists.postgresql.org Subject: Re: No error checking when reading from file using zstd in pg_dump In-reply-to: References: <6b9817a8-88ec-4efd-b441-9e2a0439c6b8@basealt.ru> <95255a86-4bc7-4ff4-aa26-4441aafdf0fb@basealt.ru> <522DB522-3962-4F91-A691-2DE790F6CCD6@yesql.se> Comments: In-reply-to Evgeniy Gorbanev message dated "Mon, 16 Jun 2025 15:51:18 +0600" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <517793.1750082166.1@sss.pgh.pa.us> Date: Mon, 16 Jun 2025 09:56:06 -0400 Message-ID: <517794.1750082166@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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