зеркало из https://github.com/github/ruby.git
* parse.y (read_escape): deny zero-width hexadecimal character.
(ruby-bugs-ja:PR#260) * parse.y (tokadd_escape): ditto. * regex.c (re_compile_pattern): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
561c59bf64
Коммит
aa79984980
|
@ -1,3 +1,12 @@
|
|||
Fri Jun 14 15:22:19 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||
|
||||
* parse.y (read_escape): deny zero-width hexadecimal character.
|
||||
(ruby-bugs-ja:PR#260)
|
||||
|
||||
* parse.y (tokadd_escape): ditto.
|
||||
|
||||
* regex.c (re_compile_pattern): ditto.
|
||||
|
||||
Thu Jun 13 09:43:37 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* eval.c (svalue_to_avalue): v may be Qundef. This fix was
|
||||
|
|
8
parse.y
8
parse.y
|
@ -2416,6 +2416,10 @@ read_escape()
|
|||
int numlen;
|
||||
|
||||
c = scan_hex(lex_p, 2, &numlen);
|
||||
if (numlen == 0) {
|
||||
yyerror("Invalid escape character syntax");
|
||||
return 0;
|
||||
}
|
||||
lex_p += numlen;
|
||||
}
|
||||
return c;
|
||||
|
@ -2501,6 +2505,10 @@ tokadd_escape(term)
|
|||
tokadd('\\');
|
||||
tokadd(c);
|
||||
scan_hex(lex_p, 2, &numlen);
|
||||
if (numlen == 0) {
|
||||
yyerror("Invalid escape character syntax");
|
||||
return -1;
|
||||
}
|
||||
while (numlen--)
|
||||
tokadd(nextc());
|
||||
}
|
||||
|
|
2
regex.c
2
regex.c
|
@ -1531,6 +1531,7 @@ re_compile_pattern(pattern, size, bufp)
|
|||
|
||||
case 'x':
|
||||
c = scan_hex(p, 2, &numlen);
|
||||
if (numlen == 0) goto invalid_escape;
|
||||
p += numlen;
|
||||
had_num_literal = 1;
|
||||
break;
|
||||
|
@ -2248,6 +2249,7 @@ re_compile_pattern(pattern, size, bufp)
|
|||
case 'x':
|
||||
had_mbchar = 0;
|
||||
c = scan_hex(p, 2, &numlen);
|
||||
if (numlen == 0) goto invalid_escape;
|
||||
p += numlen;
|
||||
had_num_literal = 1;
|
||||
goto numeric_char;
|
||||
|
|
Загрузка…
Ссылка в новой задаче