summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2018-07-26 16:46:47 (GMT)
committersebres <sebres@users.sourceforge.net>2018-07-26 16:46:47 (GMT)
commitc7cdc550c4e27c7ab0e3d4537cff99167b4509fd (patch)
tree0c28a948c45840dbffb61f6a4cfad696c97dd367 /tests
parent7e727bed70653d181a190d921ea951707ad4078a (diff)
downloadtcl-c7cdc550c4e27c7ab0e3d4537cff99167b4509fd.zip
tcl-c7cdc550c4e27c7ab0e3d4537cff99167b4509fd.tar.gz
tcl-c7cdc550c4e27c7ab0e3d4537cff99167b4509fd.tar.bz2
test cases added to cover width overflow by format (should cause limit exceeded)
Diffstat (limited to 'tests')
-rw-r--r--tests/format.test14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/format.test b/tests/format.test
index d43b7eb..5797f2b 100644
--- a/tests/format.test
+++ b/tests/format.test
@@ -565,6 +565,20 @@ test format-19.3 {Bug 2830354} {
string length [format %340f 0]
} 340
+test format-19.4.1 {Bug d498578df4: width overflow should cause limit exceeded} \
+-constraints {longIs32bit} -body {
+ # in case of overflow into negative, it produces width -2 (and limit exceeded),
+ # in case of width will be unsigned, it will be outside limit (2GB for 32bit)...
+ # and it don't throw an error in case the bug is not fixed (and probably no segfault).
+ format %[expr {0xffffffff - 1}]g 0
+} -returnCodes error -result "max size for a Tcl value exceeded"
+
+test format-19.4.2 {Bug d498578df4: width overflow should cause limit exceeded} -body {
+ # limit should exceeds in any case,
+ # and it don't throw an error in case the bug is not fixed (and probably no segfault).
+ format %[expr {0xffffffffffffffff - 1}]g 0
+} -returnCodes error -result "max size for a Tcl value exceeded"
+
# cleanup
catch {unset a}
catch {unset b}