Skip to content

Avoid NULL dereference for ordered aggregates - #337

Open
fallintoplace wants to merge 2 commits into
ClickHouse:mainfrom
fallintoplace:fix/ordered-aggregate-null-check
Open

Avoid NULL dereference for ordered aggregates#337
fallintoplace wants to merge 2 commits into
ClickHouse:mainfrom
fallintoplace:fix/ordered-aggregate-null-check

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

Summary

chfdw_check_for_ordered_aggregate() called get_extension_name() and then strcmp() without handling aggregates that are not owned by an extension. Planning an extensionless ordered-set aggregate could therefore dereference NULL and crash the backend.

This change returns false for invalid or missing extension OIDs, frees the extension name, and adds a regression covering a local ordered-set aggregate. The regression confirms that the aggregate stays local while the foreign scan retrieves its input column.

Testing

  • pg-build-test
  • make installcheck REGRESS=functions

Comment thread src/custom_types.c Outdated
@serprex
serprex requested a review from theory August 5, 2026 23:01
@theory theory self-assigned this Aug 6, 2026
@theory theory added bug Something isn't working pushdown Improvements to query pushdown aggregates Improve aggregate pushdown labels Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aggregates Improve aggregate pushdown bug Something isn't working pushdown Improvements to query pushdown

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants