postgresql/src
Andrew Dunstan e630f65d03 Fix heap-buffer-overflow in pglz_decompress() on corrupt input.
When decoding a match tag, pglz_decompress() reads 2 bytes (or 3
for extended-length matches) from the source buffer before checking
whether enough data remains.  The existing bounds check (sp > srcend)
occurs after the reads, so truncated compressed data that ends
mid-tag causes a read past the allocated buffer.

Fix by validating that sufficient source bytes are available before
reading each part of the match tag.  The post-read sp > srcend
check is no longer needed and is removed.

Found by fuzz testing with libFuzzer and AddressSanitizer.

Backpatch-through: 14
2026-04-10 10:27:16 -04:00
..
backend Fix integer overflow in nodeWindowAgg.c 2026-04-09 19:34:02 +09:00
bin Fix multiple bugs in astreamer pipeline code. 2026-03-29 09:12:28 -04:00
common Fix heap-buffer-overflow in pglz_decompress() on corrupt input. 2026-04-10 10:27:16 -04:00
fe_utils In fmtIdEnc(), handle failure of enlargePQExpBuffer(). 2025-02-16 12:46:35 -05:00
include jit: No backport::SectionMemoryManager for LLVM 22. 2026-04-03 15:01:56 +13:00
interfaces Fix some cases of indirectly casting away const. 2026-02-25 11:19:50 -05:00
makefiles Use --strip-unneeded when stripping static libraries with GNU strip. 2023-04-20 18:12:32 -04:00
pl EUC_CN, EUC_JP, EUC_KR, EUC_TW: Skip U+00A0 tests instead of failing. 2026-02-25 18:13:25 -08:00
port Fix some cases of indirectly casting away const. 2026-02-25 11:19:50 -05:00
template Use unnamed POSIX semaphores on Cygwin. 2023-01-06 10:33:28 +13:00
test Fix integer overflow in nodeWindowAgg.c 2026-04-09 19:34:02 +09:00
timezone Fix some cases of indirectly casting away const. 2026-02-25 11:19:50 -05:00
tools Fix Solution.pm for change in pg_config.h contents. 2026-02-26 12:26:52 -05:00
tutorial Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
.gitignore
DEVELOPERS
Makefile Integrate pg_bsd_indent into our build/test infrastructure. 2023-02-12 12:22:21 -05:00
Makefile.global.in Don't put library-supplied -L/-I switches before user-supplied ones. 2025-07-29 15:17:41 -04:00
Makefile.shlib Stop using "-multiply_defined suppress" on macOS. 2023-09-26 21:06:21 -04:00
meson.build Integrate pg_bsd_indent into our build/test infrastructure. 2023-02-12 12:22:21 -05:00
nls-global.mk Fix update-po for the PGXS case 2025-10-16 20:21:05 +02:00