aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--encoding.c3
-rw-r--r--test/ruby/test_regexp.rb4
2 files changed, 6 insertions, 1 deletions
diff --git a/encoding.c b/encoding.c
index f5ec1e756d..68871db268 100644
--- a/encoding.c
+++ b/encoding.c
@@ -1031,7 +1031,8 @@ rb_enc_precise_mbclen(const char *p, const char *e, rb_encoding *enc)
int
rb_enc_ascget(const char *p, const char *e, int *len, rb_encoding *enc)
{
- unsigned int c, l;
+ unsigned int c;
+ int l;
if (e <= p)
return -1;
if (rb_enc_asciicompat(enc)) {
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb
index 7eac2debbd..bdf8e48720 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -567,6 +567,10 @@ class TestRegexp < Test::Unit::TestCase
assert_equal("\\v", Regexp.quote("\v"))
assert_equal("\u3042\\t", Regexp.quote("\u3042\t"))
assert_equal("\\t\xff", Regexp.quote("\t" + [0xff].pack("C")))
+
+ bug13034 = '[ruby-core:78646] [Bug #13034]'
+ str = "\x00".force_encoding("UTF-16BE")
+ assert_equal(str, Regexp.quote(str), bug13034)
end
def test_try_convert