summaryrefslogtreecommitdiff
path: root/ChangeLog
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-22 18:18:50 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-22 18:18:50 +0000
commit6f122a4f10512bb60795faa0021e498800a7f1b8 (patch)
tree733a74d4471c4c67eb60a83573016d9873ba7da0 /ChangeLog
parent0b8b3a8296e81db90cc29c2ac663b0e8e810c89b (diff)
merge revision(s) 55547,55551,55552,55555,55557,55559,55575,55691,55568: [Backport #12536]
* string.c: Fix memory corruptions when using UTF-16/32 strings. [Bug #12536] [ruby-dev:49699] * string.c (TERM_LEN_MAX): Macro for the longest TERM_FILL length, the same as largest value of rb_enc_mbminlen(enc) among encodings. * string.c (str_new, rb_str_buf_new, str_shared_replace): Allocate +TERM_LEN_MAX bytes instead of +1. This change may increase memory usage. * string.c (rb_str_new_with_class): Use TERM_LEN of the "obj". * string.c (rb_str_plus, rb_str_justify): Use str_new0 which is aware of termlen. * string.c (str_shared_replace): Copy +termlen bytes instead of +1. * string.c (rb_str_times): termlen should not be included in capa. * string.c (RESIZE_CAPA_TERM): When using RSTRING_EMBED_LEN_MAX, termlen should be counted with it because embedded strings are also processed by TERM_FILL. * string.c (rb_str_capacity, str_shared_replace, str_buf_cat): ditto. * string.c (rb_str_drop_bytes, rb_str_setbyte, str_byte_substr): ditto. * string.c (rb_str_subseq, str_substr): When RSTRING_EMBED_LEN_MAX is used, TERM_LEN(str) should be considered with it because embedded strings are also processed by TERM_FILL. Additional fix for [Bug #12536] [ruby-dev:49699]. Additional fix for [Bug #12536] [ruby-dev:49699]. * string.c (rb_usascii_str_new, rb_utf8_str_new): Specify termlen which is apparently 1 for the encodings. * string.c (str_new0_cstr): New static function to create a String object from a C string with specifying termlen. * string.c (rb_usascii_str_new_cstr, rb_utf8_str_new_cstr): Specify termlen by using new str_new0_cstr(). * string.c (str_new_static): Specify termlen from the given encoding when creating a new String object is needed. * string.c (rb_tainted_str_new_with_enc): New function to create a tainted String object with the given encoding. This means that the termlen is correctly specified. Curretly static function. The function name might be renamed to rb_tainted_enc_str_new or rb_enc_tainted_str_new. * string.c (rb_external_str_new_with_enc): Use encoding by using the above rb_tainted_str_new_with_enc(). * string.c (str_fill_term): When termlen increases, re-allocation of memory for termlen should always be needed. In this fix, if possible, decrease capa instead of realloc. [Bug #12536] [ruby-dev:49699] * string.c: Partially reverts r55547 and r55555. ChangeLog about the reverted changes are also deleted in this file. [Bug #12536] [ruby-dev:49699] [ruby-dev:49702] * string.c (rb_str_change_terminator_length): New function to change termlen and resize heap for the terminator. This is split from rb_str_fill_terminator (str_fill_term) because filling terminator and changing terminator length are different things. [Bug #12536] * internal.h: declaration for rb_str_change_terminator_length. * string.c (str_fill_term): Simplify only to zero-fill the terminator. For non-shared strings, it assumes that (capa + termlen) bytes of heap is allocated. This partially reverts r55557. * encoding.c (rb_enc_associate_index): rb_str_change_terminator_length is used, and it should be called whenever the termlen is changed. * string.c (str_capacity): New static function to return capacity of a string with the given termlen, because the termlen may sometimes be different from TERM_LEN(str) especially during changing termlen or filling terminator with specific termlen. * string.c (rb_str_capacity): Use str_capacity. * string.c (str_buf_cat): Fix capa size for embed string. Fix bug in r55547. [Bug #12536] * string.c: Specify termlen as far as possible. the termlen is correctly specified. Currently static function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@55988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ChangeLog')
-rw-r--r--ChangeLog87
1 files changed, 87 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index c9113c3cbd..5620c4ba43 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,90 @@
+Tue Aug 23 03:14:22 2016 Naohisa Goto <ngotogenome@gmail.com>
+
+ * string.c (str_buf_cat): Fix capa size for embed string.
+ Fix bug in r55547. [Bug #12536]
+
+Tue Aug 23 03:14:22 2016 Naohisa Goto <ngotogenome@gmail.com>
+
+ * string.c (rb_str_change_terminator_length): New function to change
+ termlen and resize heap for the terminator. This is split from
+ rb_str_fill_terminator (str_fill_term) because filling terminator
+ and changing terminator length are different things. [Bug #12536]
+
+ * internal.h: declaration for rb_str_change_terminator_length.
+
+ * string.c (str_fill_term): Simplify only to zero-fill the terminator.
+ For non-shared strings, it assumes that (capa + termlen) bytes of
+ heap is allocated. This partially reverts r55557.
+
+ * encoding.c (rb_enc_associate_index): rb_str_change_terminator_length
+ is used, and it should be called whenever the termlen is changed.
+
+ * string.c (str_capacity): New static function to return capacity
+ of a string with the given termlen, because the termlen may
+ sometimes be different from TERM_LEN(str) especially during
+ changing termlen or filling terminator with specific termlen.
+
+ * string.c (rb_str_capacity): Use str_capacity.
+
+Tue Aug 23 03:14:22 2016 Naohisa Goto <ngotogenome@gmail.com>
+
+ * string.c: Partially reverts r55547 and r55555.
+ ChangeLog about the reverted changes are also deleted in this file.
+ [Bug #12536] [ruby-dev:49699] [ruby-dev:49702]
+
+Tue Aug 23 03:14:22 2016 Naohisa Goto <ngotogenome@gmail.com>
+
+ * string.c (str_fill_term): When termlen increases, re-allocation
+ of memory for termlen should always be needed.
+ In this fix, if possible, decrease capa instead of realloc.
+ [Bug #12536] [ruby-dev:49699]
+
+Tue Aug 23 03:14:22 2016 Naohisa Goto <ngotogenome@gmail.com>
+
+ * string.c: Specify termlen as far as possible.
+ Additional fix for [Bug #12536] [ruby-dev:49699].
+
+ * string.c (str_new_static): Specify termlen from the given encoding
+ when creating a new String object is needed.
+
+ * string.c (rb_tainted_str_new_with_enc): New function to create a
+ tainted String object with the given encoding. This means that
+ the termlen is correctly specified. Currently static function.
+ The function name might be renamed to rb_tainted_enc_str_new
+ or rb_enc_tainted_str_new.
+
+ * string.c (rb_external_str_new_with_enc): Use encoding by using the
+ above rb_tainted_str_new_with_enc().
+
+Tue Aug 23 03:14:22 2016 Naohisa Goto <ngotogenome@gmail.com>
+
+ * string.c (rb_str_subseq, str_substr): When RSTRING_EMBED_LEN_MAX
+ is used, TERM_LEN(str) should be considered with it because
+ embedded strings are also processed by TERM_FILL.
+ Additional fix for [Bug #12536] [ruby-dev:49699].
+
+Tue Aug 23 03:14:22 2016 Naohisa Goto <ngotogenome@gmail.com>
+
+ * string.c: Fix memory corruptions when using UTF-16/32 strings.
+ [Bug #12536] [ruby-dev:49699]
+
+ * string.c (rb_str_new_with_class): Use TERM_LEN of the "obj".
+
+ * string.c (rb_str_plus, rb_str_justify): Use str_new0 which is aware
+ of termlen.
+
+ * string.c (str_shared_replace): Copy +termlen bytes instead of +1.
+
+ * string.c (rb_str_times): termlen should not be included in capa.
+
+ * string.c (RESIZE_CAPA_TERM): When using RSTRING_EMBED_LEN_MAX,
+ termlen should be counted with it because embedded strings are
+ also processed by TERM_FILL.
+
+ * string.c (rb_str_capacity, str_shared_replace, str_buf_cat): ditto.
+
+ * string.c (rb_str_drop_bytes, rb_str_setbyte, str_byte_substr): ditto.
+
Thu Aug 18 23:43:33 2016 Eric Wong <e@80x24.org>
* ext/openssl/ossl_ssl.c (ossl_ssl_write_internal):