From 5486fdbb77a4921c407e511dcd6c5fbd8cf5caa3 Mon Sep 17 00:00:00 2001 From: mpi Date: Wed, 1 Sep 2021 13:22:36 +0000 Subject: [PATCH] Rergression for printing a @map after calling clear(). Adapted from a test case generated by AFL++. ok jasper@ --- regress/usr.sbin/btrace/Makefile | 4 ++-- regress/usr.sbin/btrace/read-map-after-clear.bt | 7 +++++++ regress/usr.sbin/btrace/read-map-after-clear.ok | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 regress/usr.sbin/btrace/read-map-after-clear.bt create mode 100644 regress/usr.sbin/btrace/read-map-after-clear.ok 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: -- 2.20.1