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

Fix VisualShader connection use after free. #84832

Merged
merged 1 commit into from
Nov 13, 2023

Conversation

alesliehughes
Copy link
Contributor

Coverity has picked up this as a "Use after free", the object E is deteled bu erase but is used straight after multiple times e->get().
Moving to the end of the if seems to make the most sense.

@alesliehughes alesliehughes requested a review from a team as a code owner November 13, 2023 06:26
@akien-mga akien-mga changed the title Fix use after free. Fix VisualShader connection use after free. Nov 13, 2023
@akien-mga akien-mga added this to the 4.2 milestone Nov 13, 2023
Copy link
Contributor

@jsjtxietian jsjtxietian left a comment

Choose a reason for hiding this comment

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

IMHO you can use a more comprehensive commit message like your pr title

Copy link
Contributor

@YuriSizov YuriSizov left a comment

Choose a reason for hiding this comment

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

Could probably use some refactoring to avoid doing E->get() a bunch of times, but looks fine as a quick fix.

@alesliehughes
Copy link
Contributor Author

Could probably use some refactoring to avoid doing E->get() a bunch of times, but looks fine as a quick fix.

Sure, I can refactor it.

@alesliehughes
Copy link
Contributor Author

I've refactored the code as a second commit. I can squish them if you prefer.

@YuriSizov
Copy link
Contributor

YuriSizov commented Nov 13, 2023

Sorry if I wasn't clear, but that wasn't necessary and I didn't mean for you to do it. You should probably remove the second commit.

@alesliehughes
Copy link
Contributor Author

Sorry if I wasn't clear, but that wasn't necessary and I didn't mean for you to do it. You should probably remove the second commit.

All good. I'm new and not sure of the how much to put into a commit yet.

@YuriSizov
Copy link
Contributor

And by removing it I meant removing it, not squashing it. We prefer squashed commits for PRs, but in this case I was asking you to revert your PR to the original change as it was already approved and sufficient.

@alesliehughes
Copy link
Contributor Author

And by removing it I meant removing it, not squashing it. We prefer squashed commits for PRs, but in this case I was asking you to revert your PR to the original change as it was already approved and sufficient.

Restored back to the original point. Will submitted another PR once this is upstream.

@YuriSizov
Copy link
Contributor

YuriSizov commented Nov 13, 2023

Will submitted another PR once this is upstream.

I don't want to discourage you, but I just wanted to make it clear that that was just my musings. It's not really necessary and you've already fixed the problem itself. Maybe a slightly reworked code could be better for future maintenance, but it's a minor thing, which is why we approved your PR as it was and didn't ask for any changes.

Thanks for humoring me though! If you wish to contribute more, there are many more bugs to tackle in this issue tracker 🙂

@akien-mga akien-mga merged commit 8b705af into godotengine:master Nov 13, 2023
15 checks passed
@akien-mga
Copy link
Member

Thanks! And congrats for your first merged Godot contribution 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants