Skip to content

Conversation

yjhjstz
Copy link
Member

@yjhjstz yjhjstz commented Aug 8, 2025

This patch prevents several use after free bugs present in flatten_join_alias_var_optimizer. Specifically, the function uses flatten_join_alias_vars function multiple times, and assumes that the original node can be freed immediately after. This is not always the case since under some circumstances flatten_join_alias_vars does not modify its input and simply passes it through without copying. This patch adds conditions to check if the original node can safely be freed, preventing use after free.

Fixes #ISSUE_Number

What does this PR do?

Type of Change

  • Bug fix (non-breaking change)
  • New feature (non-breaking change)
  • Breaking change (fix or feature with breaking changes)
  • Documentation update

Breaking Changes

Test Plan

  • Unit tests added/updated
  • Integration tests added/updated
  • Passed make installcheck
  • Passed make -C src/test installcheck-cbdb-parallel

Impact

Performance:

User-facing changes:

Dependencies:

Checklist

Additional Context

CI Skip Instructions


This patch prevents several use after free bugs present in
flatten_join_alias_var_optimizer. Specifically, the function uses
flatten_join_alias_vars function multiple times, and assumes that the
original node can be freed immediately after. This is not always the case
since under some circumstances flatten_join_alias_vars does not modify its
input and simply passes it through without copying. This patch adds conditions
to check if the original node can safely be freed, preventing use after free.
Copy link
Contributor

@my-ship-it my-ship-it left a comment

Choose a reason for hiding this comment

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

LGTM

@yjhjstz
Copy link
Member Author

yjhjstz commented Aug 12, 2025

ci failed, related #1309

@avamingli avamingli added the type: Orca only orca has the issue label Aug 14, 2025
Copy link
Contributor

@jiaqizho jiaqizho left a comment

Choose a reason for hiding this comment

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

LGTM

@yjhjstz yjhjstz marked this pull request as draft August 15, 2025 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: Orca only orca has the issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants