mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
[Bug #19108] Check for the encoding of pack/unpack format
This commit is contained in:
parent
a1d341efaf
commit
9869bd1d61
Notes:
git
2022-12-01 08:38:52 +00:00
2 changed files with 16 additions and 0 deletions
2
pack.c
2
pack.c
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue