sed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[INSTALLED] maint: add test cases for integer overflow


From: Paul Eggert
Subject: [INSTALLED] maint: add test cases for integer overflow
Date: Mon, 19 Dec 2022 13:47:51 -0800

* testsuite/execute-tests.sh: Add some tests with
enormous integers.
---
 testsuite/execute-tests.sh | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/testsuite/execute-tests.sh b/testsuite/execute-tests.sh
index 6c9668c..1a2544f 100644
--- a/testsuite/execute-tests.sh
+++ b/testsuite/execute-tests.sh
@@ -70,6 +70,19 @@ compare_ in6 out6 || fail=1
 printf "%s\n" a | sed -n 'P' > out7 || fail=1
 compare_ in6 out7 || fail=1
 
+#
+# 'q' and other commands with big numbers (2**256 + 1, 2 ** 256 + 2)
+#
+big1=115792089237316195423570985008687907853269984665640564039457584007913129639937
+big2=115792089237316195423570985008687907853269984665640564039457584007913129639938
+printf '%s\n' a b >in7a || framework_failure_
+sed ${big1}q in7a >out7a1 || fail=1
+compare_ in7a out7a1 || fail=1
+sed -n 1,${big1}p in7a >out7a2 || fail=1
+compare_ in7a out7a2 || fail=1
+sed ${big1},${big2}d in7a >out7a3 || fail=1
+compare_ in7a out7a3 || fail=1
+
 #
 # 'Q' with exit code
 #
-- 
2.38.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]