diff options
author | fvogel <fvogelnew1@free.fr> | 2023-08-28 19:52:26 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2023-08-28 19:52:26 (GMT) |
commit | dffec92d52a76512ba9b8d1480d5b783466ca31e (patch) | |
tree | aa380bf2226349a914e7f121df908b59df0cd690 /tests/menu.test | |
parent | 9dab97c810595239cdb0f30da35df964460e9e40 (diff) | |
download | tk-dffec92d52a76512ba9b8d1480d5b783466ca31e.zip tk-dffec92d52a76512ba9b8d1480d5b783466ca31e.tar.gz tk-dffec92d52a76512ba9b8d1480d5b783466ca31e.tar.bz2 |
Add non-regression test menu-40.1 demonstrating use-after-free (bug [1797555fff]). This bug is already fixed by [32a43619cd].
Diffstat (limited to 'tests/menu.test')
-rw-r--r-- | tests/menu.test | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/menu.test b/tests/menu.test index f206a9e..24263c0 100644 --- a/tests/menu.test +++ b/tests/menu.test @@ -4084,6 +4084,24 @@ test menu-39.1 {empty -type - bug be8f5b9fc2} -setup { destroy .m } -returnCodes error -result {ambiguous type "": must be normal, tearoff, or menubar} +test menu-40.1 {use-after-free fix - bug 1797555fff} -setup { + toplevel .t + menu .t.menubar -type menubar + menu .t.menubar.select -title Select + menu .t.menubar.select.chain -title Chain + .t.menubar.select insert 1 cascade -menu .t.menubar.select.chain -label Chain + .t.menubar add cascade -menu .t.menubar.select -label Select + .t configure -menu .t.menubar + .t.menubar.select.chain insert 1 command + update idletasks +} -body { + # The following two lines caused Tk to read from and write to freed memory + destroy .t.menubar.select.chain + .t.menubar.select delete 1 +} -cleanup { + destroy .t +} -result {} + # cleanup imageFinish |