From 569cfcee61560d07f2e68e68d200da64b2c10f7e Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sat, 11 Feb 2017 21:49:50 +0000 Subject: Do not read one element past the end of the static const termacts array. Bug found by Sevan Janiyan who ran the OpenBSD mandoc test suite on Ubuntu on POWER8 (sic!) and reported that mdoc/Sh/before.in failed in -Tman mode. If that isn't power testing, i don't know... --- man_term.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/man_term.c b/man_term.c index e4f106b9..a2f32c7e 100644 --- a/man_term.c +++ b/man_term.c @@ -822,7 +822,8 @@ pre_SH(DECL_ARGS) do { n = n->prev; - } while (n != NULL && termacts[n->tok].flags & MAN_NOTEXT); + } while (n != NULL && n->tok < MAN_MAX && + termacts[n->tok].flags & MAN_NOTEXT); if (n == NULL || (n->tok == MAN_SH && n->body->child == NULL)) break; -- cgit