diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-08-09 13:49:27 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-08-09 13:49:27 +0000 |
commit | b800677425e0839eac1014d0a2fe9201cabe3a18 (patch) | |
tree | b7b58cdaa28601729107b6857d5373b58399e0ae /pack.c | |
parent | f45af0c60b6e4341294f92dcc10e0b80e2ed087b (diff) |
merge revision(s) 34972:
* pack.c (pack_unpack): when unpack('M') occurs an illegal byte
sequence, output the "=" character and the following character in
the decoded data without any transformation.
[ruby-dev:44875] [Bug #5635]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@36669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'pack.c')
-rw-r--r-- | pack.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -2003,7 +2003,7 @@ pack_unpack(VALUE str, VALUE fmt) case 'M': { VALUE buf = infected_str_new(0, send - s, str); - char *ptr = RSTRING_PTR(buf); + char *ptr = RSTRING_PTR(buf), *ss = s; int c1, c2; while (s < send) { @@ -2022,8 +2022,10 @@ pack_unpack(VALUE str, VALUE fmt) *ptr++ = *s; } s++; + ss = s; } rb_str_set_len(buf, ptr - RSTRING_PTR(buf)); + rb_str_buf_cat(buf, ss, send-ss); ENCODING_CODERANGE_SET(buf, rb_ascii8bit_encindex(), ENC_CODERANGE_VALID); UNPACK_PUSH(buf); } |