* 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:
nobu 2002-06-14 06:27:18 +00:00
parent 561c59bf64
commit aa79984980
3 changed files with 19 additions and 0 deletions

View File

@ -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

View File

@ -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());
}

View File

@ -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;