From 751954a95b11620a0729815eee5feeaa166a265c 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'man_term.c') diff --git a/man_term.c b/man_term.c index fd2fc993..0db372c4 100644 --- a/man_term.c +++ b/man_term.c @@ -1,4 +1,4 @@ -/* $Id: man_term.c,v 1.189 2017/02/04 11:58:09 schwarze Exp $ */ +/* $Id: man_term.c,v 1.190 2017/02/11 21:49:50 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2015, 2017 Ingo Schwarze @@ -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 v1.2.3-56-ge451