aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop
diff options
context:
space:
mode:
authorBrian Ashworth <RedSoxFan@users.noreply.github.com>2018-07-28 01:31:43 -0400
committerGitHub <noreply@github.com>2018-07-28 01:31:43 -0400
commit92a4bc646a52b1715f4885d7459c07b7a26a2d21 (patch)
tree815a384ed1a54f390e46805c1ae0927449b29430 /sway/desktop
parent7ad9d743faa485b35ee5d38224736f445db071d2 (diff)
parent073ac425d5bf6f6393eb91d9b5f84e3caa68f511 (diff)
Merge pull request #2370 from RyanDwyer/transactions-use-after-free
Fix use after free in transactions
Diffstat (limited to 'sway/desktop')
-rw-r--r--sway/desktop/transaction.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index ee7a0704..0a24c4fc 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -364,7 +364,13 @@ static void set_instructions_ready(struct sway_view *view, int index) {
struct sway_transaction_instruction *instruction =
view->swayc->instructions->items[i];
if (!instruction->ready) {
+ // set_instruction_ready can remove instructions from the list we're
+ // iterating
+ size_t length = view->swayc->instructions->length;
set_instruction_ready(instruction);
+ size_t num_removed = length - view->swayc->instructions->length;
+ i -= num_removed;
+ index -= num_removed;
}
}
}