summaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-06-14 06:27:18 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-06-14 06:27:18 +0000
commit839a57c00c979ea377d253adf5169da99a7c8b4f (patch)
tree96a9ff8c8e0f2c4b61c68b445e32a75e22f0ba16 /parse.y
parentf9aeae3ffe0f72fcbcdb0e0dd65594ab64d3554c (diff)
downloadruby-839a57c00c979ea377d253adf5169da99a7c8b4f.tar.gz
ruby-839a57c00c979ea377d253adf5169da99a7c8b4f.tar.xz
ruby-839a57c00c979ea377d253adf5169da99a7c8b4f.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@2568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y8
1 files changed, 8 insertions, 0 deletions
diff --git a/parse.y b/parse.y
index a200f0b14..e4f4627dc 100644
--- a/parse.y
+++ b/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());
}