diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-29 09:19:15 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-29 09:19:15 +0000 |
commit | daa622aed079b4434e607820d7577b4a7d4f2bfc (patch) | |
tree | 5a7cfc28983ed2e26680686bc23eb47de95fa813 /time.c | |
parent | deff2a3e247d9dd42ac55d9ecfeb7f567aac9fd4 (diff) | |
download | ruby-daa622aed079b4434e607820d7577b4a7d4f2bfc.tar.gz |
* time.c (time_strftime): format should be ascii compatible.
* parse.y (rb_intern3): non ASCII compatible symbols.
* re.c (rb_reg_regsub): add encoding check.
* string.c (rb_str_chomp_bang): ditto.
* test/ruby/test_utf16.rb (TestUTF16::test_chomp): raises exception.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r-- | time.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -12,6 +12,7 @@ #include "ruby/ruby.h" #include <sys/types.h> #include <time.h> +#include "ruby/encoding.h" #ifdef HAVE_UNISTD_H #include <unistd.h> @@ -2077,6 +2078,9 @@ time_strftime(VALUE time, VALUE format) time_get_tm(time, tobj->gmt); } StringValue(format); + if (!rb_enc_str_asciicompat_p(format)) { + rb_raise(rb_eArgError, "format should have ASCII compatible encoding"); + } format = rb_str_new4(format); fmt = RSTRING_PTR(format); len = RSTRING_LEN(format); |