| From: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
|---|---|
| To: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
| Cc: | PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> |
| Subject: | Re: Fix detection of truncated zstd-compressed backups |
| Date: | 2026-08-10 16:28:14 |
| Message-ID: | CF427D27-3AF6-4C0E-ABAE-9FF7DED20FCD@yesql.se |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> On 10 Aug 2026, at 10:11, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>> On Aug 10, 2026, at 14:45, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>> See attached 0002 for the fix of gzip streamer. I will check the lz4 streamer next.
>
> Confirmed that lz4 also has the same problem. See the similar repro script:
Thanks for this patchset, I think this is something we should fix. I took the
liberty to squash the patchset into a single patch to start preparing it for
the final shape, as well as adding a testcase to verify this.
+ /* Reject empty input, which does not contain a complete zstd frame. */
+ streamer->decompression_ret = 1;
I am not a huge fan of this, we claim that we save the return value but then we
assign a value which hasn't yet been returned as a sentinel. Given that the
return is a size_t we also can't really invent a sentinel. Since we don't
actually use the returned value for anything but "done or not-done", so I
propose something like the attached which interprets the value and stores a
named state. What are your thoughts on this?
--
Daniel Gustafsson
| Attachment | Content-Type | Size |
|---|---|---|
| v4-0001-Fix-detection-of-truncated-compressed-backups.patch | application/octet-stream | 8.1 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nathan Bossart | 2026-08-10 16:30:17 | Re: problems with toast.* reloptions |
| Previous Message | Robert Haas | 2026-08-10 16:04:52 | preventing shell injection |