diff options
author | jenglish <jenglish@noemail.net> | 2007-05-18 21:46:09 (GMT) |
---|---|---|
committer | jenglish <jenglish@noemail.net> | 2007-05-18 21:46:09 (GMT) |
commit | 16e2c652f8de0fe2d91fa00fc878b81354b6271f (patch) | |
tree | daacf52364071c6ac1bda0b6495d801ab2929071 /tests/ttk | |
parent | 59806eb2619be6c89e1024e1aa55b095b8067940 (diff) | |
download | tk-16e2c652f8de0fe2d91fa00fc878b81354b6271f.zip tk-16e2c652f8de0fe2d91fa00fc878b81354b6271f.tar.gz tk-16e2c652f8de0fe2d91fa00fc878b81354b6271f.tar.bz2 |
EntrySetValue: Ensure that widget is in a consistent state before setting
the linked -textvariable. Previously, it was possible for [$e index insert]
to point past the end of the string, leading to heap corruption [Bug 1721532].
FossilOrigin-Name: 6e624fd3ec8886cffe28f45649d20212a066fe5c
Diffstat (limited to 'tests/ttk')
-rw-r--r-- | tests/ttk/entry.test | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ttk/entry.test b/tests/ttk/entry.test index 3ac9182..929e856 100644 --- a/tests/ttk/entry.test +++ b/tests/ttk/entry.test @@ -259,4 +259,25 @@ test entry-8.2a "Followup to test 8.2" -body { } -result ::test::foo -cleanup { destroy .e } # For 8.2a, -result {} would also be sensible. +test entry-9.1 "Index range invariants" -setup { + # See bug#1721532 for discussion + proc entry-9.1-trace {n1 n2 op} { + set ::V NO! + } + variable V + trace add variable V write entry-9.1-trace + ttk::entry .e -textvariable V +} -body { + set result [list] + .e insert insert a ; lappend result [.e index insert] [.e index end] + .e insert insert b ; lappend result [.e index insert] [.e index end] + .e insert insert c ; lappend result [.e index insert] [.e index end] + .e insert insert d ; lappend result [.e index insert] [.e index end] + .e insert insert e ; lappend result [.e index insert] [.e index end] + set result +} -result [list 1 3 2 3 3 3 3 3 3 3] -cleanup { + unset V + destroy .e +} + tcltest::cleanupTests |