]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix yet another bug in archive streamer with LZ4 decompression.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 4 Mar 2026 17:08:37 +0000 (12:08 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 4 Mar 2026 17:08:37 +0000 (12:08 -0500)
commit415cc943ffdd591c513cc9c526d219095e72a278
tree45ad1dae49b095aae56b26e6c1216f2c3accf24e
parent46c54d3d2f3ec0aaf04eaf5ea5eade08d4796b87
Fix yet another bug in archive streamer with LZ4 decompression.

The code path in astreamer_lz4_decompressor_content() that updated
the output pointers when the output buffer isn't full was wrong.
It advanced next_out by bytes_written, which could include previous
decompression output not just that of the current cycle.  The
correct amount to advance is out_size.  While at it, make the
output pointer updates look more like the input pointer updates.

This bug is pretty hard to reach, as it requires consecutive
compression frames that are too small to fill the output buffer.
pg_dump could have produced such data before 66ec01dc4, but
I'm unsure whether any files we use astreamer with would be
likely to contain problematic data.

Author: Chao Li <lic@highgo.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/0594CC79-1544-45DD-8AA4-26270DE777A7@gmail.com
Backpatch-through: 15
src/bin/pg_basebackup/bbstreamer_lz4.c