Repository navigation
[#1805] walinfo: Don't copy offset arrays past fixed-size record wrappers - #1806
Open
rythmlongia wants to merge 1 commit into
Open
rythmlongia wants to merge 1 commit into
rythmlongia wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1805.
create_spg_xlog_vacuum_redirect(),create_gist_xlog_delete()andcreate_xl_hash_vacuum_one_page()allocate their wrappers withmalloc(sizeof(...)), which leaves no room for theoffsets[FLEXIBLE_ARRAY_MEMBER]array. The parsers then copied the whole array from the record, writing past the allocation as soon as the array didn't fit in the struct's padding (4 or more entries for SP-GiSTVACUUM_REDIRECT).offsetsis never read: the format functions don't print it, and the wrapper is freed right after formatting. This removes the four copies:pgmoneta_wal_parse_spg_xlog_vacuum_redirect_v15/_v16(rm_spgist.c)pgmoneta_wal_parse_gist_xlog_delete_v16(rm_gist.c)pgmoneta_wal_parse_xl_hash_vacuum_one_page_v16(rm_hash.c)Testing on PostgreSQL 16 WAL with an SP-GiST index after
DELETE/UPDATE/VACUUM(two segments, ASan build):rm_spgist.cThe output for all records now matches
pg_waldumpin count and LSNs.