aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <RedSoxFan@users.noreply.github.com>2018-07-28 01:31:43 -0400
committerLibravatar GitHub <noreply@github.com>2018-07-28 01:31:43 -0400
commit92a4bc646a52b1715f4885d7459c07b7a26a2d21 (patch)
tree815a384ed1a54f390e46805c1ae0927449b29430
parentMerge pull request #2369 from mihaicmn/preserve-workspace-name (diff)
parentFix use after free in transactions (diff)
downloadsway-92a4bc646a52b1715f4885d7459c07b7a26a2d21.tar.gz
sway-92a4bc646a52b1715f4885d7459c07b7a26a2d21.tar.zst
sway-92a4bc646a52b1715f4885d7459c07b7a26a2d21.zip
Merge pull request #2370 from RyanDwyer/transactions-use-after-free
Fix use after free in transactions
-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) {
364 struct sway_transaction_instruction *instruction = 364 struct sway_transaction_instruction *instruction =
365 view->swayc->instructions->items[i]; 365 view->swayc->instructions->items[i];
366 if (!instruction->ready) { 366 if (!instruction->ready) {
367 // set_instruction_ready can remove instructions from the list we're
368 // iterating
369 size_t length = view->swayc->instructions->length;
367 set_instruction_ready(instruction); 370 set_instruction_ready(instruction);
371 size_t num_removed = length - view->swayc->instructions->length;
372 i -= num_removed;
373 index -= num_removed;
368 } 374 }
369 } 375 }
370} 376}