Skip to content

[#704] Reject RowDescription column counts above MAX_NUMBER_OF_COLUMNS - #705

Open
Pranav-error wants to merge 1 commit into
pgexporter:mainfrom
Pranav-error:fix-rowdesc-column-bound
Open

Pranav-error wants to merge 1 commit into
pgexporter:mainfrom
Pranav-error:fix-rowdesc-column-bound

Conversation

@Pranav-error

Copy link
Copy Markdown
Collaborator

Fixes #704.

build_query() now rejects a RowDescription whose column count is below 0 or above MAX_NUMBER_OF_COLUMNS instead of writing past names and type_oids.

test_query_params_too_many_columns in the new test_queries.c sends a RowDescription with more than 32 columns through a socketpair. It fails on main and passes with this change. Built and run on macOS, clang-format clean.

Copilot AI balanced review requested due to automatic review settings November 24, 2026 20:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

…_OF_COLUMNS

build_query() copied the column count from the server's RowDescription into names[MAX_NUMBER_OF_COLUMNS] and type_oids[MAX_NUMBER_OF_COLUMNS] unchecked, so a larger count wrote past the query struct. Reject a count outside 0..MAX_NUMBER_OF_COLUMNS. A socketpair test sends an oversized RowDescription.
@Pranav-error
Pranav-error force-pushed the fix-rowdesc-column-bound branch from f51570c to ca227ff Compare December 1, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build_query overflows the query struct on a RowDescription with too many columns

2 participants