* 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:
parent
561c59bf64
commit
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>
|
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
|
* 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;
|
int numlen;
|
||||||
|
|
||||||
c = scan_hex(lex_p, 2, &numlen);
|
c = scan_hex(lex_p, 2, &numlen);
|
||||||
|
if (numlen == 0) {
|
||||||
|
yyerror("Invalid escape character syntax");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
lex_p += numlen;
|
lex_p += numlen;
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
@ -2501,6 +2505,10 @@ tokadd_escape(term)
|
|||||||
tokadd('\\');
|
tokadd('\\');
|
||||||
tokadd(c);
|
tokadd(c);
|
||||||
scan_hex(lex_p, 2, &numlen);
|
scan_hex(lex_p, 2, &numlen);
|
||||||
|
if (numlen == 0) {
|
||||||
|
yyerror("Invalid escape character syntax");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
while (numlen--)
|
while (numlen--)
|
||||||
tokadd(nextc());
|
tokadd(nextc());
|
||||||
}
|
}
|
||||||
|
2
regex.c
2
regex.c
@ -1531,6 +1531,7 @@ re_compile_pattern(pattern, size, bufp)
|
|||||||
|
|
||||||
case 'x':
|
case 'x':
|
||||||
c = scan_hex(p, 2, &numlen);
|
c = scan_hex(p, 2, &numlen);
|
||||||
|
if (numlen == 0) goto invalid_escape;
|
||||||
p += numlen;
|
p += numlen;
|
||||||
had_num_literal = 1;
|
had_num_literal = 1;
|
||||||
break;
|
break;
|
||||||
@ -2248,6 +2249,7 @@ re_compile_pattern(pattern, size, bufp)
|
|||||||
case 'x':
|
case 'x':
|
||||||
had_mbchar = 0;
|
had_mbchar = 0;
|
||||||
c = scan_hex(p, 2, &numlen);
|
c = scan_hex(p, 2, &numlen);
|
||||||
|
if (numlen == 0) goto invalid_escape;
|
||||||
p += numlen;
|
p += numlen;
|
||||||
had_num_literal = 1;
|
had_num_literal = 1;
|
||||||
goto numeric_char;
|
goto numeric_char;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user