summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2021-09-01 13:22:37 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2021-09-01 13:22:37 +0000
commit5ab0c4ee7316e4647235be809ad31209b550e5a7 (patch)
tree837aa19fc1ceb8ecda61961849db55654a2efc30 /regress
parentd53f5f88a7f016a5ec8aacc76ad9077f386b4614 (diff)
Rergression for printing a @map after calling clear().
Adapted from a test case generated by AFL++. ok jasper@
Diffstat (limited to 'regress')
-rw-r--r--regress/usr.sbin/btrace/Makefile4
-rw-r--r--regress/usr.sbin/btrace/read-map-after-clear.bt7
-rw-r--r--regress/usr.sbin/btrace/read-map-after-clear.ok1
3 files changed, 10 insertions, 2 deletions
diff --git a/regress/usr.sbin/btrace/Makefile b/regress/usr.sbin/btrace/Makefile
index 145512cf65a..0e2aba1398b 100644
--- a/regress/usr.sbin/btrace/Makefile
+++ b/regress/usr.sbin/btrace/Makefile
@@ -1,11 +1,11 @@
-# $OpenBSD: Makefile,v 1.11 2021/08/31 12:51:56 mpi Exp $
+# $OpenBSD: Makefile,v 1.12 2021/09/01 13:22:36 mpi Exp $
BTRACE?= /usr/sbin/btrace
# scripts that don't need /dev/dt
BT_LANG_SCRIPTS= arithm beginend boolean comments delete exit if map \
map-unnamed maxoperand min+max+sum multismts nsecs+var \
- precedence print
+ precedence print read-map-after-clear
BT_KERN_SCRIPTS=
diff --git a/regress/usr.sbin/btrace/read-map-after-clear.bt b/regress/usr.sbin/btrace/read-map-after-clear.bt
new file mode 100644
index 00000000000..73266910f6c
--- /dev/null
+++ b/regress/usr.sbin/btrace/read-map-after-clear.bt
@@ -0,0 +1,7 @@
+BEGIN
+{
+ @map[7] = 2;
+ clear(@map);
+ printf("=> Print after clear should not crash %d:\n", @map);
+}
+
diff --git a/regress/usr.sbin/btrace/read-map-after-clear.ok b/regress/usr.sbin/btrace/read-map-after-clear.ok
new file mode 100644
index 00000000000..f1ede837bf9
--- /dev/null
+++ b/regress/usr.sbin/btrace/read-map-after-clear.ok
@@ -0,0 +1 @@
+=> Print after clear should not crash 0: