indent(1): Avoid out-of-bound accesses of array ps.p_stack.

Submitted by:	 Piotr Stefaniak
This commit is contained in:
Pedro F. Giffuni 2016-12-02 16:42:45 +00:00
parent 0bae80a336
commit 488f148604

View File

@ -172,7 +172,7 @@ parse(int tk) /* tk: the code for the construct scanned */
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;
}