From owner-svn-src-head@freebsd.org Fri Dec 2 16:42:46 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C163CC63087; Fri, 2 Dec 2016 16:42:46 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 913AA104F; Fri, 2 Dec 2016 16:42:46 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB2GgjkC012705; Fri, 2 Dec 2016 16:42:45 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB2Ggj1Q012704; Fri, 2 Dec 2016 16:42:45 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201612021642.uB2Ggj1Q012704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 2 Dec 2016 16:42:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r309419 - head/usr.bin/indent X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Dec 2016 16:42:46 -0000 Author: pfg Date: Fri Dec 2 16:42:45 2016 New Revision: 309419 URL: https://svnweb.freebsd.org/changeset/base/309419 Log: indent(1): Avoid out-of-bound accesses of array ps.p_stack. Submitted by: Piotr Stefaniak Modified: head/usr.bin/indent/parse.c Modified: head/usr.bin/indent/parse.c ============================================================================== --- head/usr.bin/indent/parse.c Fri Dec 2 16:41:08 2016 (r309418) +++ head/usr.bin/indent/parse.c Fri Dec 2 16:42:45 2016 (r309419) @@ -172,7 +172,7 @@ parse(int tk) /* tk: the code for the co case rbrace: /* scanned a } */ /* stack should have or */ - if (ps.p_stack[ps.tos - 1] == lbrace) { + if (ps.tos > 0 && ps.p_stack[ps.tos - 1] == lbrace) { ps.ind_level = ps.i_l_follow = ps.il[--ps.tos]; ps.p_stack[ps.tos] = stmt; }