postgresql/src
Heikki Linnakangas 19f82323db Fix ReadRecentBuffer for local buffers.
It incorrectly used GetBufferDescriptor instead of
GetLocalBufferDescriptor, causing it to not find the correct buffer in
most cases, and performing an out-of-bounds memory read in the corner
case that temp_buffers > shared_buffers.

It also bumped the usage-count on the buffer, even if it was
previously pinned. That won't lead to crashes or incorrect results,
but it's different from what the shared-buffer case does, and
different from the usual code in LocalBufferAlloc. Fix that too, and
make the code ordering match LocalBufferAlloc() more closely, so that
it's easier to verify that it's doing the same thing.

Currently, ReadRecentBuffer() is only used with non-temp relations, in
WAL redo, so the broken code is currently dead code. However, it could
be used by extensions.

Backpatch-through: 14
Discussion: https://www.postgresql.org/message-id/2d74b46f-27c9-fb31-7f99-327a87184cc0%40iki.fi
Reviewed-by: Thomas Munro, Zhang Mingli, Richard Guo
2022-07-25 08:53:03 +03:00
..
backend Fix ReadRecentBuffer for local buffers. 2022-07-25 08:53:03 +03:00
bin Fix minor memory leaks in psql's tab completion. 2022-07-22 10:53:26 -04:00
common logging: Also add the command prefix to detail and hint messages 2022-05-30 07:26:06 +02:00
fe_utils Fix minor memory leaks in psql's tab completion. 2022-07-22 10:53:26 -04:00
include Fix missed corner cases for grantable permissions on GUCs. 2022-07-19 17:22:31 -04:00
interfaces Fix [install]check in interfaces/libpq/Makefile 2022-07-22 20:15:11 +02:00
makefiles Refactor DLSUFFIX handling 2022-03-25 08:56:02 +01:00
pl Fix missed corner cases for grantable permissions on GUCs. 2022-07-19 17:22:31 -04:00
port Fix get_dirent_type() for Windows junction points. 2022-07-22 16:57:36 +12:00
template Refactor DLSUFFIX handling 2022-03-25 08:56:02 +01:00
test Doc: update recovery/README. 2022-07-23 16:10:38 -04:00
timezone Update time zone data files to tzdata release 2022a. 2022-05-05 14:54:53 -04:00
tools expression eval: Fix EEOP_JSON_CONSTRUCTOR and EEOP_JSONEXPR size. 2022-07-05 11:26:27 -07:00
tutorial Update copyright for 2022 2022-01-07 19:04:57 -05:00
.gitignore
DEVELOPERS
Makefile Remove the option to build thread_test.c outside configure. 2020-10-21 12:08:48 -04:00
Makefile.global.in Increase minimum supported GNU make version to 3.81. 2022-07-23 12:12:42 -04:00
Makefile.shlib AIX: Fix missing libpq symbols by respecting SHLIB_EXPORTS. 2021-09-06 11:27:59 -07:00
nls-global.mk Improve frontend error logging style. 2022-04-08 14:55:14 -04:00