diff options
author | Andres Freund <andres@anarazel.de> | 2023-04-01 17:55:33 -0700 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2023-04-01 18:00:19 -0700 |
commit | a88a18b1250b9e6b40536e4dec04d32d655b8140 (patch) | |
tree | 6c3efcbc617c65143bd9c0dfc21ffe348d240678 | |
parent | 14f98e0af996beff561f66d7436c6da5d2de524d (diff) | |
download | postgresql-a88a18b1250b9e6b40536e4dec04d32d655b8140.tar.gz postgresql-a88a18b1250b9e6b40536e4dec04d32d655b8140.zip |
Assert only valid flag bits are passed to visibilitymap_set()
If visibilitymap_set() is called with flags containing a higher bit than
VISIBILITYMAP_ALL_FROZEN, the state of neighboring pages is affected. While
there was an assertion that *some* valid bits were set, it did not check
that *only* valid bits were. Change that.
Discussion: https://postgr.es/m/20230331043300.gux3s5wzrapqi4oe@awork3.anarazel.de
-rw-r--r-- | src/backend/access/heap/visibilitymap.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/access/heap/visibilitymap.c b/src/backend/access/heap/visibilitymap.c index 74ff01bb172..e193682352a 100644 --- a/src/backend/access/heap/visibilitymap.c +++ b/src/backend/access/heap/visibilitymap.c @@ -259,9 +259,9 @@ visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf, Assert(InRecovery || XLogRecPtrIsInvalid(recptr)); Assert(InRecovery || PageIsAllVisible((Page) BufferGetPage(heapBuf))); + Assert((flags & VISIBILITYMAP_VALID_BITS) == flags); /* Must never set all_frozen bit without also setting all_visible bit */ - Assert(flags & VISIBILITYMAP_VALID_BITS); Assert(flags != VISIBILITYMAP_ALL_FROZEN); /* Check that we have the right heap page pinned, if present */ |