diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-11-22 14:25:44 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-12-01 17:38:33 +0900 |
commit | 9869bd1d612b489df806cf95bcb56965a02424e0 (patch) | |
tree | 1b1c53882fb5aaa0cbc48e184c4c76421decebc0 /pack.c | |
parent | a1d341efaf0b357e7aad3700ed7551559b4fcdf8 (diff) |
[Bug #19108] Check for the encoding of pack/unpack format
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6785
Diffstat (limited to 'pack.c')
-rw-r--r-- | pack.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -208,6 +208,7 @@ pack_pack(rb_execution_context_t *ec, VALUE ary, VALUE fmt, VALUE buffer) int integer_size, bigendian_p; StringValue(fmt); + rb_must_asciicompat(fmt); p = RSTRING_PTR(fmt); pend = p + RSTRING_LEN(fmt); @@ -959,6 +960,7 @@ pack_unpack_internal(VALUE str, VALUE fmt, enum unpack_mode mode, long offset) StringValue(str); StringValue(fmt); + rb_must_asciicompat(fmt); if (offset < 0) rb_raise(rb_eArgError, "offset can't be negative"); len = RSTRING_LEN(str); |