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 #8332: aborting group drag&drop could cause crashes with vehicle drag&drop #8511

Merged
merged 1 commit into from Jan 7, 2021

Conversation

TrueBrain
Copy link
Member

Motivation / Problem

You could easily crash the game when aborting group drag&drop.

This is a partial backport of downstream patch:
JGRennison/OpenTTD-patches@66630ef

The other part of this patch seems somewhat pedantic, and mostly partial. There are more places in the GUI where ::Get is done, which is not safeguarded either. See limitations how I think this could be abused. I kept this out of scope of this PR, as it would require much more changes for very unlikely edge-cases (in my opinion).

Description

The selected group was not reset when drag&drop was aborted. When
after that vehicle drag&drop was successful, group drag&drop code
was still executed, causing weird behaviour or even crashes.

Limitations

  • In a coop-multiplayer game, when you do a group drag&drop, and your coop player removes your group during that time, releasing your drag&drop on another group crashes your game.
  • Related, in a coop-multiplayer game, when you do a vehicle drag&drop, and your coop player removes your vehicle during that time, dragging the vehicle over a group can crash the game
  • There are a few more of these: if someone in a coop-multiplayer game ....

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

…ehicle drag&drop

The selected group was not reset when drag&drop was aborted. When
after that vehicle drag&drop was successful, group drag&drop code
was still executed, causing weird behaviour or even crashes.
@TrueBrain TrueBrain merged commit c988b4d into OpenTTD:master Jan 7, 2021
@TrueBrain TrueBrain deleted the crash-group-gui branch January 7, 2021 09:32
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.

None yet

2 participants