From aa2b48262b02b2f6f23ba7f032f8ea1fb0bddbe3 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Sat, 25 Feb 2023 09:26:06 +0000 Subject: Fix and tests for [46dda6fc29] --- generic/tclUtil.c | 4 ++-- tests/dstring.test | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/generic/tclUtil.c b/generic/tclUtil.c index e96a564..8f2c16f 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -1143,13 +1143,13 @@ TclScanElement( */ requireEscape = 1; - length -= (length > 0); + length -= (length+1 > 1); p++; break; } if ((p[1] == '{') || (p[1] == '}') || (p[1] == '\\')) { extra++; /* Escape sequences all one byte longer. */ - length -= (length > 0); + length -= (length+1 > 1); p++; } forbidNone = 1; diff --git a/tests/dstring.test b/tests/dstring.test index 8699a5e..23863d0 100644 --- a/tests/dstring.test +++ b/tests/dstring.test @@ -218,7 +218,7 @@ test dstring-2.16 {appending list elements - bug [46dda6fc29] segfault} -constra testdstring get } -cleanup { testdstring free -} -result {} +} -result \\\\\\n test dstring-2.17 {appending list elements - bug [46dda6fc29] segfault} -constraints testdstring -setup { testdstring free } -body { @@ -226,7 +226,7 @@ test dstring-2.17 {appending list elements - bug [46dda6fc29] segfault} -constra testdstring get } -cleanup { testdstring free -} -result {} +} -result [list [list \{]] test dstring-2.18 {appending list elements - bug [46dda6fc29] segfault} -constraints testdstring -setup { testdstring free } -body { @@ -234,7 +234,7 @@ test dstring-2.18 {appending list elements - bug [46dda6fc29] segfault} -constra testdstring get } -cleanup { testdstring free -} -result {} +} -result [list [list \}]] test dstring-2.19 {appending list elements - bug [46dda6fc29] segfault} -constraints testdstring -setup { testdstring free } -body { @@ -242,7 +242,7 @@ test dstring-2.19 {appending list elements - bug [46dda6fc29] segfault} -constra testdstring get } -cleanup { testdstring free -} -result {} +} -result [list [list \\]] test dstring-3.1 {nested sublists} -constraints testdstring -setup { testdstring free -- cgit v0.12