diff options
author | cmaynard <cmaynard@f5534014-38df-0310-8fa8-9805f1628bb7> | 2011-04-01 16:55:59 +0000 |
---|---|---|
committer | cmaynard <cmaynard@f5534014-38df-0310-8fa8-9805f1628bb7> | 2011-04-01 16:55:59 +0000 |
commit | 66b5d16e3f5f5d6e4393d74b0bbe104e77cc9f32 (patch) | |
tree | 7cb5cc86b5588fdd9cec476478d14e7438ee5df8 /tools | |
parent | d9eb469ea5291ff2178038d9e9ad4e34f2e376b4 (diff) |
Don't use pParser->yyidx as an index into pParser->yystack[] until after it is
verified that it is non-negative. Should resolve CID 619.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@36431 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'tools')
-rw-r--r-- | tools/lemon/lempar.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/lemon/lempar.c b/tools/lemon/lempar.c index 6ac188097c..72e5f6018e 100644 --- a/tools/lemon/lempar.c +++ b/tools/lemon/lempar.c @@ -327,11 +327,12 @@ static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ */ static int yy_pop_parser_stack(yyParser *pParser){ YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; + yyStackEntry *yytos; if( pParser->yyidx<0 ) return 0; + yytos = &pParser->yystack[pParser->yyidx]; #ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ + if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sPopping %s\n", yyTracePrompt, yyTokenName[yytos->major]); |