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

Better dialog queueing error handling, documentation. #50763

Merged
merged 1 commit into from
Aug 14, 2021

Conversation

Ramza13
Copy link
Contributor

@Ramza13 Ramza13 commented Aug 14, 2021

Summary

Infrastructure "Better dialog queueing error handling, documentation"

Purpose of change

Fix for issues found while working on #50685.

Describe the solution

Describe alternatives you've considered

Testing

Additional context

@@ -2364,7 +2368,11 @@ void talk_effect_fun_t::set_weighted_list_eocs( const JsonObject &jo,
}
eocs.add( eoc, weight );
}
function = [&eocs]( const dialogue & ) {
function = [eocs]( const dialogue & ) {
Copy link
Member

@anothersimulacrum anothersimulacrum Aug 14, 2021

Choose a reason for hiding this comment

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

Why do you need to copy it?

Suggested change
function = [eocs]( const dialogue & ) {
function = [&eocs]( const dialogue & ) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the portal branch if you don't copy it you get an invalid array error. Not an expert on c++ memory handling but pretty sure if you don't copy it, it will go out of scope if set for the future.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, you're setting a member variable to this function. Yeah, eocs will go out of scope and then this function will trigger UAF.

@actual-nh actual-nh added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Mechanics: Effects / Skills / Stats Effects / Skills / Stats labels Aug 14, 2021
@kevingranade kevingranade merged commit 9b3c251 into CleverRaven:master Aug 14, 2021
@Ramza13 Ramza13 deleted the portal_sidework branch August 14, 2021 13:14
satheon49 pushed a commit to satheon49/Cataclysm-DDA that referenced this pull request Aug 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Mechanics: Effects / Skills / Stats Effects / Skills / Stats
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants