]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix memory overrun when querying pg_stat_slru
authorMichael Paquier <michael@paquier.xyz>
Fri, 12 Nov 2021 12:50:04 +0000 (21:50 +0900)
committerMichael Paquier <michael@paquier.xyz>
Fri, 12 Nov 2021 12:50:04 +0000 (21:50 +0900)
commit5f81a480d537956efc0b9bf2eee7d651a03c596a
tree3b8bbaca7b30decd20cbc6f5647cd06e3638e822
parent675cd765c2a5d5f2f020a5bf647086c178612abf
Fix memory overrun when querying pg_stat_slru

pg_stat_get_slru() in pgstatfuncs.c would point to one element after the
end of the array PgStat_SLRUStats when finishing to scan its entries.
This had no direct consequences as no data from the extra memory area
was read, but static analyzers would rightfully complain here.  So let's
be clean.

While on it, this adds one regression test in the area reserved for
system views.

Reported-by: Alexander Kozhemyakin, via AddressSanitizer
Author: Kyotaro Horiguchi
Discussion: https://postgr.es/m/17280-37da556e86032070@postgresql.org
Backpatch-through: 13
src/backend/utils/adt/pgstatfuncs.c
src/test/regress/expected/sysviews.out
src/test/regress/sql/sysviews.sql