diff options
author | Tony Cook <tony@develop-help.com> | 2018-01-30 16:40:53 +1100 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2018-02-06 09:13:31 +1100 |
commit | bb4e4c3869d9fb6ee5bddd820c2a373601ecc310 (patch) | |
tree | cf7b4bcfcfc4d20c184e06a6dea9fff9bf8aed8b /parser.h | |
parent | 4bfb5532d393d56b18d13bc19f70f6f7a64ae781 (diff) | |
download | perl-bb4e4c3869d9fb6ee5bddd820c2a373601ecc310.tar.gz |
(perl #125351) abort parsing if parse errors happen in a sub lex
We've had a few reports of segmentation faults and other misbehaviour
when sub-parsing, such as within interpolated expressions, fails.
This change aborts compilation if anything complex enough to not be
parsed by the lexer is compiled in a sub-parse *and* an error
occurs within the sub-parse.
An earlier version of this patch failed on simpler expressions,
which caused many test failures, which this version doesn't (which may
just mean we need more tests...)
Diffstat (limited to 'parser.h')
-rw-r--r-- | parser.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -58,6 +58,7 @@ typedef struct yy_parser { 1 = @{...} 2 = ->@ */ U8 expect; /* how to interpret ambiguous tokens */ bool preambled; + bool sub_no_recover; /* can't recover from a sublex error */ I32 lex_formbrack; /* bracket count at outer format level */ OP *lex_inpat; /* in pattern $) and $| are special */ OP *lex_op; /* extra info to pass back on op */ @@ -95,6 +96,7 @@ typedef struct yy_parser { U16 in_my; /* we're compiling a "my"/"our" declaration */ U8 lex_state; /* next token is determined */ U8 error_count; /* how many compile errors so far, max 10 */ + U8 sub_error_count; /* the number of errors before sublexing */ HV *in_my_stash; /* declared class of this "my" declaration */ PerlIO *rsfp; /* current source file pointer */ AV *rsfp_filters; /* holds chain of active source filters */ |