aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* string.c: avoid signed integer overflowtopic/string-integer-overflowKazuki Yamaguchi2016-09-131-48/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The behavior on signed integer overflow is undefined. On platform with sizeof(long)==4, it's fairly easy that 'len + termlen' overflows, where len is the string length and termlen is the terminator length. So, prevent the integer overflow by avoiding adding to a string length, or casting to size_t before adding where the total size is passed to {RE,}ALLOC*(). * string.c (STR_HEAP_SIZE, RESIZE_CAPA_TERM, str_new0, rb_str_buf_new, str_shared_replace, rb_str_init, str_make_independent_expand, rb_str_resize): Avoid overflow by casting the length to size_t. size_t should be able to represent LONG_MAX+termlen. * string.c (rb_str_modify_expand): Check that the new length is in the range of long before resizing. Also refactor to use RESIZE_CAPA_TERM macro. * string.c (str_buf_cat): Fix so that it does not create a negative length String. Also fix the condition for 'string sizes too big', the total length can be up to LONG_MAX. * string.c (rb_str_plus): Check the resulting String length does not exceed LONG_MAX. * string.c (rb_str_dump): Fix integer overflow. The dump result will be longer then the original String.
* Use PRIuSIZE format specifier for size_t valuesKazuki Yamaguchi2016-09-137-19/+19
| | | | | | | | | | | | | | | | | | | | | | | Use PRIuSIZE instead of PRIdSIZE. This fixes the exception message shown on too large xmalloc2. This commit also fixes other incorrect use of PRIdSIZE in other functions; most of them are debug print. * gc.c (heap_extend_pages, get_envparam_size, ruby_malloc_size_overflow, gc_profile_dump_on): Use PRIuSIZE instead of PRIdSIZE as the passed value is size_t, not ssize_t. * iseq.c (get_line_info, rb_iseq_disasm_insn): Ditto. * sprintf.c (rb_str_format): Ditto. * thread_win32.c (native_thread_create): Ditto. * vm.c (get_param): Ditto. * ext/objspace/objspace_dump.c (dump_append_string_content, dump_object): Ditto. * ext/socket/raddrinfo.c (host_str, port_str): Ditto.
* string.c: rename STR_EMBEDABLE_P to STR_EMBEDDABLE_Prhe2016-09-132-15/+22
| | | | | | | * string.c (STR_EMBEDDABLE_P): Renamed from STR_EMBEDABLE_P(). And use it in more places. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* README{,.ja}.md: Drop support for BeOS now that Haiku is stable since 2.3.0. ↵kazu2016-09-133-2/+9
| | | | | | [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix a typo [ci skip]kazu2016-09-131-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix unbalanced backquote [ci skip]kazu2016-09-131-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: STR_EMBEDABLE_Pnobu2016-09-132-3/+12
| | | | | | | | * string.c (STR_EMBEDABLE_P): extract the predicate macro to tell if the given length is capable in an embedded string, and fix possible integer overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_exception.rb: fix thread issues.ko12016-09-132-3/+11
| | | | | | | | * use Queue instead of a local variable for synchronization. * join created thread to soleve leaking threads warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: fix integer overflownobu2016-09-131-1/+2
| | | | | | | | * string.c (rb_str_change_terminator_length): fix integer overflow in the case growing the terminator length and the string length is around LONG_MAX. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: fix buffer overflow check condition in rb_str_set_len()rhe2016-09-133-1/+20
| | | | | | | | | | | | * string.c (rb_str_set_len): The buffer overflow check is wrong. The space for termlen is allocated outside the capacity returned by rb_str_capacity(). This fixes r41920 ("string.c: multi-byte terminator", 2013-07-11). [ruby-core:77257] [Bug #12757] * test/-ext-/string/test_set_len.rb (test_capacity_equals_to_new_size): Test for this change. Applying only the test will trigger [BUG]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* openssl: workaround for Ubuntu's patched OpenSSLrhe2016-09-131-2/+5
| | | | | | | | | | * test/openssl/test_ssl.rb (test_ctx_options): Add a workaround for patched OpenSSL to fix the Ruby CI failure on Ubuntu 16.04. http://rubyci.s3.amazonaws.com/ubuntu/ruby-trunk/log/20160913T033003Z.fail.html.gz This commit is a cherry-pick of the following commit at ruby/openssl: https://github.com/ruby/openssl/commit/f9c04779a84b45d85dc26dc19ea600d0613539e2 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * common.mk (benchmark): fix lib path.naruse2016-09-122-3/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * properties.svn2016-09-120-0/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Copy the serial number from the super class to the singleton classtenderlove2016-09-123-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This helps hit inline method caches more frequently. Before this commit: ``` [aaron@TC ruby (trunk)]$ time ./ruby -v benchmark/bm_vm2_poly_singleton.rb ruby 2.4.0dev (2016-09-12 trunk 56141) [x86_64-darwin15] real 0m3.679s user 0m3.632s sys 0m0.022s ``` After this commit: ``` [aaron@TC ruby (trunk)]$ time ./ruby -v benchmark/bm_vm2_poly_singleton.rb ruby 2.4.0dev (2016-09-12 trunk 56141) [x86_64-darwin15] last_commit=Copy the serial number from the super class to the singleton class real 0m2.246s user 0m2.203s sys 0m0.020s ``` [Feature #12364] [ruby-core:75425] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2016-09-13svn2016-09-121-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * time.c (time_arg): guard for mswin64 CI.usa2016-09-121-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Added missing references of github and redmine.hsbt2016-09-121-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2016-09-12svn2016-09-121-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/uri/mailto.rb: Removed needless `return` and use `.`` instead of `::`hsbt2016-09-123-5/+62
| | | | | | | with class method. * test/uri/test_mailto.rb: Added tests for coverage. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* NEWS: News about Module.used_modules.kazu2016-09-112-0/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix a typo [ci skip]kazu2016-09-111-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Update URL of Japanese document of net/popkazu2016-09-111-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use https instead of http in some URLskazu2016-09-1114-31/+31
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ChangeLog: added refs. [Bug #12748] [ruby-dev:49786]usa2016-09-111-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2016-09-11svn2016-09-111-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * win32/win32.c (rb_w32_write_console): should set writen length as theusa2016-09-112-2/+6
| | | | | | | | return value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2016-09-10svn2016-09-101-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* extension.rdoc: rb_check_arity [ci skip]nobu2016-09-101-0/+9
| | | | | | * doc/extension.rdoc (rb_check_arity): described. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gems/bundled_gems: sort lines.kazu2016-09-092-4/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* json_generator_test.rb: no Bignumnobu2016-09-091-2/+3
| | | | | | | * test/json/json_generator_test.rb (test_broken_bignum): get rid of use of Bignum, obsolete name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread.c: set cause by Thread#raisenobu2016-09-094-0/+66
| | | | | | | | * thread.c (rb_threadptr_raise): set cause from the called thread, but not from the thread to be interrupted. [ruby-core:77222] [Bug #12741] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix file names [ci skip]nobu2016-09-093-2/+7
| | | | | | | * doc/extension.rdoc, doc/extension.ja.rdoc: fix file name. pointed out by @takkanm in the RubyKaigi talk. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * News: Announcing update to Unicode version 9.0.0 [ci skip]duerst2016-09-092-0/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* object.c: update rdocnobu2016-09-091-11/+6
| | | | | | | * object.c (InitVM_Object): update rdoc of NIL/TRUE/FALSE, and use rb_deprecate_constant. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* variable.c: rb_deprecate_constantnobu2016-09-092-0/+17
| | | | | | | * variable.c (rb_deprecate_constant): new function to deprecate a constant by the name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* variable.c: fix deprecated constant messagenobu2016-09-093-2/+6
| | | | | | | * variable.c (rb_const_search): warn with the actual class/module name which defines the deprecated constant. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* variable.c: fix private constant messagenobu2016-09-093-1/+9
| | | | | | | * variable.c (rb_const_search): raise with the actual class/module name which defines the private constant. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2016-09-09svn2016-09-091-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* e2mmap.rb: remove legacy codenobu2016-09-091-1/+0
| | | | | | | * lib/e2mmap.rb (Exception2MessageMapper::E2MM.def_exception): remove legacy code. Symbol is no longer a number already. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: check if Integernobu2016-09-081-1/+1
| | | | | | | * io.c (rb_file_initialize): check if fd is an Integer but not a Fixnum. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (flatten): use rb_obj_class instead of rb_class_ofktsj2016-09-083-1/+25
| | | | | | | because rb_class_of may return a singleton class. [ruby-dev:49781] [Bug #12738] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rbinstall.rb: gem bindirnobu2016-09-082-1/+6
| | | | | | | * tool/rbinstall.rb (gem): use the bindir of each gemspec instead of hardcoded 'bin', since rdoc 5.0.0 overrides it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (rb_mod_s_used_modules): rename Module.used_refinements toshugo2016-09-083-17/+22
| | | | | | Module.used_modules. [Feature #7418] [ruby-core:49805] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Unbundle tknaruse2016-09-081-1/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Update svn:ignore [ci skip]kazu2016-09-080-0/+0
| | | | | | | | * enc/unicode/data/9.0.0 (svn:ignore): ignore downloaded files. see r55716 for 8.0.0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/psych/psych.gemspec, lib/rdoc/rdoc.gemspec: Use file list instead ofhsbt2016-09-083-2/+12
| | | | | | | git output. It shows warning message when invoke `make install` [Bug #12736][ruby-dev:49778] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* replace fixnum by integer in documents.akr2016-09-0815-123/+123
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * insns.def (setclassvariable, setconstant): warn when self is ashugo2016-09-084-0/+31
| | | | | | refinement. [Bug #10103] [ruby-core:64143] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* NEWS: Add Hash#transform_valuesmrkn2016-09-081-0/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: map_v -> transform_valuesmrkn2016-09-083-25/+33
| | | | | | | | | | * hash.c (rb_hash_transform_values, rb_hash_transform_values_bang): Rename map_v to transform_values. [Feature #12512] [ruby-core:76095] * test/ruby/test_hash.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e