Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new fields to copyFuncs to avoid issues with uninitialized memory. #219

Conversation

timchang514
Copy link
Contributor

@timchang514 timchang514 commented Sep 20, 2023

Description

#166 added two new fields to IntoClause. The fields need to be added to copyFuncs, or else they will be used uninitialized and at risk of causing a crash.

Issues Resolved

One of the crashes in sp_who can be resolved by this.

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is under the terms of the PostgreSQL license, and grant any person obtaining a copy of the contribution permission to relicense all or a portion of my contribution to the PostgreSQL License solely to contribute all or a portion of my contribution to the PostgreSQL open source project.

For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@lejaokri
Copy link
Contributor

Thanks Tim.

I am not familiar with this part of the code, but I am wondering if we should also be modifying the following code to handle the new fields?

592 static IntoClause *
 593 _readIntoClause(void)
 594 {
 595     READ_LOCALS(IntoClause);
 596
 597     READ_NODE_FIELD(rel);
 598     READ_NODE_FIELD(colNames);
 599     READ_STRING_FIELD(accessMethod);
 600     READ_NODE_FIELD(options);
 601     READ_ENUM_FIELD(onCommit, OnCommitAction);
 602     READ_STRING_FIELD(tableSpaceName);
 603     READ_NODE_FIELD(viewQuery);
 604     READ_BOOL_FIELD(skipData);
 605
 606     READ_DONE();
 607 }
147 static bool
 148 _equalIntoClause(const IntoClause *a, const IntoClause *b)
 149 {
 150     COMPARE_NODE_FIELD(rel);
 151     COMPARE_NODE_FIELD(colNames);
 152     COMPARE_STRING_FIELD(accessMethod);
 153     COMPARE_NODE_FIELD(options);
 154     COMPARE_SCALAR_FIELD(onCommit);
 155     COMPARE_STRING_FIELD(tableSpaceName);
 156     COMPARE_NODE_FIELD(viewQuery);
 157     COMPARE_SCALAR_FIELD(skipData);
 158
 159     return true;
 160 }
1121 static void
1122 _outIntoClause(StringInfo str, const IntoClause *node)
1123 {
1124     WRITE_NODE_TYPE("INTOCLAUSE");
1125
1126     WRITE_NODE_FIELD(rel);
1127     WRITE_NODE_FIELD(colNames);
1128     WRITE_STRING_FIELD(accessMethod);
1129     WRITE_NODE_FIELD(options);
1130     WRITE_ENUM_FIELD(onCommit, OnCommitAction);
1131     WRITE_STRING_FIELD(tableSpaceName);
1132     WRITE_NODE_FIELD(viewQuery);
1133     WRITE_BOOL_FIELD(skipData);
1134 }

@lejaokri
Copy link
Contributor

lejaokri commented Sep 25, 2023

LGTM but let's wait for someone more familiar with the code to take another look. Thanks!

@forestkeeper forestkeeper merged commit 26b4e99 into babelfish-for-postgresql:BABEL_3_X_DEV__PG_15_X Sep 25, 2023
2 checks passed
Sairakan pushed a commit to amazon-aurora/postgresql_modified_for_babelfish that referenced this pull request Nov 16, 2023
priyansx pushed a commit to amazon-aurora/postgresql_modified_for_babelfish that referenced this pull request Nov 22, 2023
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.

3 participants