Date: Fri, 2 Dec 2016 16:42:45 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r309419 - head/usr.bin/indent Message-ID: <201612021642.uB2Ggj1Q012704@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <lbrace> <stmt> or <lbrace> <stmtl> */ - 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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612021642.uB2Ggj1Q012704>