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

ADBDEV-6616: Fix potentially clobbered variables in PG_TRY/PG_CATCH blocks #43

Open
wants to merge 2 commits into
base: gpdb
Choose a base branch
from

Conversation

KnightMurloc
Copy link

@KnightMurloc KnightMurloc commented Nov 7, 2024

Fix potentially clobbered variables in PG_TRY/PG_CATCH blocks

Some local variables may have an undefined value after longjmp, which can lead
to undefined behavior.

This patch adds volatile to such variables based on a compiler warning. Fix a
potential memory leak related to creating a hashmap inside a try/catch block.
Add a compiler flag for throwing error related to clobbering variables.

Some local variables may have an undefined value after longjmp, which can lead
to undefined behavior.

This patch adds volatile to such variables based on a compiler warning.
Fix a potential memory leak related to creating a hashmap inside a try/catch
block.
Add a compiler flag for throwing warnings related to clobbering variables.
@KnightMurloc KnightMurloc marked this pull request as ready for review November 7, 2024 11:09
@RekGRpth

This comment was marked as resolved.

@KnightMurloc
Copy link
Author

Why make local variables volatile that are used only in the PG_CATCH block

I'm not sure why this is necessary, but the compiler throws out a warning for these variables too.

@RekGRpth

This comment was marked as resolved.

@KnightMurloc
Copy link
Author

Are you suggesting adding -Werror?

@RekGRpth

This comment was marked as resolved.

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.

2 participants