ruby-changes:45002
From: nobu <ko1@a...>
Date: Wed, 14 Dec 2016 16:30:46 +0900 (JST)
Subject: [ruby-changes:45002] nobu:r57075 (trunk): parse.y: curtail scanning
nobu 2016-12-14 16:30:41 +0900 (Wed, 14 Dec 2016) New Revision: 57075 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57075 Log: parse.y: curtail scanning * parse.y (parser_yyerror): curtail scanning range, not to exceed the max margin. Modified files: trunk/parse.y Index: parse.y =================================================================== --- parse.y (revision 57074) +++ parse.y (revision 57075) @@ -5255,18 +5255,21 @@ parser_yyerror(struct parser_params *par https://github.com/ruby/ruby/blob/trunk/parse.y#L5255 const char *p, *pe; const char *pre = "", *post = ""; const char *code = "", *caret = "", *newline = ""; + const char *lim; char *buf; long len; int i; p = lex_p; - while (lex_pbeg < p) { + lim = p - lex_pbeg > max_line_margin ? p - max_line_margin : lex_pbeg; + while (lim < p) { if (*(p-1) == '\n') break; p--; } pe = lex_p; - while (pe < lex_pend) { + lim = lex_pend - pe > max_line_margin ? pe + max_line_margin : lex_pend; + while (pe < lim) { if (*pe == '\n') break; pe++; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/