summaryrefslogtreecommitdiff
path: root/usr.sbin/btrace
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2021-09-07 19:18:09 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2021-09-07 19:18:09 +0000
commit1b00904f38d0996d7b812e86fa13865398e0959f (patch)
tree78198fa3a1937e8a93a27895fef5dc2736df49e0 /usr.sbin/btrace
parentc5fee755bec684e0e84693e8434f317750ff1d3f (diff)
Return early if a parsing error has been found and do not perform any
sanity check as they might obviously fail. Fix an assert found by jasper@ with AFL++ (port coming soon!). ok jasper@
Diffstat (limited to 'usr.sbin/btrace')
-rw-r--r--usr.sbin/btrace/bt_parse.y6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/btrace/bt_parse.y b/usr.sbin/btrace/bt_parse.y
index 9cda3581be6..9639019183d 100644
--- a/usr.sbin/btrace/bt_parse.y
+++ b/usr.sbin/btrace/bt_parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: bt_parse.y,v 1.37 2021/08/31 12:51:24 mpi Exp $ */
+/* $OpenBSD: bt_parse.y,v 1.38 2021/09/07 19:18:08 mpi Exp $ */
/*
* Copyright (c) 2019-2021 Martin Pieuchot <mpi@openbsd.org>
@@ -971,8 +971,10 @@ btparse(const char *str, size_t len, const char *filename, int debug)
yylval.lineno = 1;
yyparse();
+ if (perrors)
+ return perrors;
assert(SLIST_EMPTY(&l_variables));
- return perrors;
+ return 0;
}