No error checking when reading from file using zstd in pg_dump

From: Evgeniy Gorbanev <gorbanyoves(at)basealt(dot)ru>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: No error checking when reading from file using zstd in pg_dump
Date: 2025-06-16 08:14:36
Message-ID: 6b9817a8-88ec-4efd-b441-9e2a0439c6b8@basealt.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello.

In src/bin/pg_dump/compress_zstd.c, the Zstd_read function always
returns true. But if you look at the Zstd_gets and Zstd_getc functions,
where Zstd_read is called via CFH->read_func, it is expected that
the Zstd_read function can also return false. In case of
a read-from-file error, the process is expected to terminate, but
pg_dump will continue the process.
I assume that after checking
if (cnt == 0)
should be
return false;

Patch attached.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Reporter: Evgeniy Gorbanev (gorbanyoves(at)basealt(dot)ru).

Organization: BaseALT (org(at)basealt(dot)ru).

Best regards,
Evgeniy

Attachment Content-Type Size
compress_zstd.diff text/x-patch 440 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2025-06-16 08:25:43 Re: No error checking when reading from file using zstd in pg_dump
Previous Message Daniel Gustafsson 2025-06-16 08:05:51 Re: [PATCH] Fix incomplete memory clearing in OAuth authentication