summaryrefslogtreecommitdiff
path: root/array.c
AgeCommit message (Collapse)Author
2008-06-29merge revision(s) 17570:shyouhei
* array.c (rb_ary_fill): not depend on unspecified behavior at integer overflow. reported by Vincenzo Iozzo <snagg AT openssl.it>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@17686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-20merge revision(s) 17470:17472:shyouhei
* array.c (rb_ary_store, rb_ary_splice): not depend on unspecified behavior at integer overflow. * string.c (str_buf_cat): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@17480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-19* array.c (ary_new, rb_ary_initialize, rb_ary_store,shyouhei
rb_ary_aplice, rb_ary_times): integer overflows should be checked. based on patches from Drew Yao <ayao at apple.com> fixed CVE-2008-2726 * string.c (rb_str_buf_append): fixed unsafe use of alloca, which led memory corruption. based on a patch from Drew Yao <ayao at apple.com> fixed CVE-2008-2726 * sprintf.c (rb_str_format): backported from trunk. * intern.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@17460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-31Merge from ruby_1_8.knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-29Merge from ruby_1_8.knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-29Fix a typo.knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-28* array.c (rb_ary_slice_bang): Call rb_ary_modify_check() at theknu
beginning. [rubyspec] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-27Merge from ruby_1_8.knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-24Merge from ruby_1_8.knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-22Merge from ruby_1_8.knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-22Merge from ruby_1_8.knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-18Merge -r16241:16456 from ruby_1_8.knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-25Merge from ruby_1_8.knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-19Merge everything from ruby_1_8.knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-15* array.c (rb_ary_take_while, rb_ary_drop_while): removed unusednobu
variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-14* array.c (rb_ary_flatten, rb_ary_flatten_bang): Take an optionalknu
argument that determines the level of recursion to flatten; backported from 1.9. * array.c (rb_ary_shuffle_bang, rb_ary_shuffle, rb_ary_choice, rb_ary_cycle, rb_ary_permutation, rb_ary_combination, rb_ary_product, rb_ary_take, rb_ary_take_while, rb_ary_drop, rb_ary_drop_while): New methods: Array#shuffle, #shuffle!, #choice, #cycle, #permutation, #combination, #product, #take, #take_while, #drop, #drop_while; backported from 1.9. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-14* array.c (rb_ary_collect_bang, rb_ary_select): Return anknu
enumerator if no block is given. * dir.c (dir_each, dir_foreach): Return an enumerator if no block is given. * enum.c (enum_partition, enum_sort_by): Ditto. * gc.c (os_each_obj): Ditto. * hash.c (rb_hash_delete_if, rb_hash_reject_bang, rb_hash_select, rb_hash_each_value, rb_hash_each_key, rb_hash_each_pair, env_each_key, env_each_value, env_each, env_each_pair, env_reject_bang, env_delete_if, env_select): Ditto. * numeric.c (num_step, int_upto, int_downto, int_dotimes): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-14* enum.c (enum_count, enum_find_index): New methods:knu
Enumerable#count and #find_index; backported from 1.9. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-10* array.c (rb_ary_first, rb_ary_last): Return a shared array whenknu
possible. * array.c (rb_ary_pop, rb_ary_pop_m, rb_ary_shift, rb_ary_shift_m): Array#pop and Array#shift can take an optional argument specifying the number of elements to remove and return; backported from 1.9. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-09Fix a typo.knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-09* array.c (rb_ary_pop): Do not reallocate too often; backportedknu
from 1.9. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-09Array#reject too.knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-09* array.c (rb_ary_each, rb_ary_each_index, rb_ary_reverse_each,knu
rb_ary_reject_bang): Calling Array#each, #each_index, #reverse_each, #reject! or #delete_if without a block now returns an enumerator; backported from 1.9. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-09* array.c (rb_ary_index, rb_ary_index): Array#index and #rindexknu
take a block instead of an argument; backported from 1.9. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15936 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-07* array.c (rb_ary_nitems): Backport Array#nitems with a block;knu
suggested by Bertram Scharpf <lists@bertram-scharpf.de> in [ruby-talk:134083]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-10* array.c (rb_ary_slice_bang): If an invalid negative index (<=knu
-size) is given, do not raise an exception but return nil just like slice() does. * test/ruby/test_array.rb (TestArray::test_slice, TestArray::test_slice!): Pull in test cases from trunk. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@14184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-02* array.c (rb_ary_assoc): check and convert inner arrays (assocs)matz
using #to_ary. * hash.c (rb_hash_s_create): check and convert argument hash using #to_hash. * hash.c (rb_hash_s_create): Hash#[] now takes assocs as source of hash conversion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-05* array.c (rb_ary_subseq): need integer overflow check.matz
[ruby-dev:31736] * array.c (rb_ary_splice): ditto. [ruby-dev:31737] * array.c (rb_ary_fill): ditto. [ruby-dev:31738] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-05* array.c (rb_ary_fill): need integer overflow check.matz
[ruby-dev:31738] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-30* array.c (rb_ary_initialize): should call rb_ary_modify() first.matz
[ruby-core:11562] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-18* array.c (rb_ary_first): add negative length check.matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-18* array.c (rb_ary_first): call rb_ary_subseq() instead of pushingmatz
values by itself. [ruby-talk:252062] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-18* array.c (rb_ary_shift): shorten copy size. fixed: [ruby-list:42907]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-01* array.c (rb_ary_shift): should not move memory region if arraymatz
body is shared. a patch from Kent Sibilev <ksruby at gmail.com>. [ruby-core:08922] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-24* array.c (rb_ary_shift): should clear shifting top element.matz
[ruby-talk:216055] * array.c (rb_ary_shift): avoid creating shared object if array size is small. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-24comment rb_ary_new4 behavior in Ruby 1.9.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-05-03* ext/syck/emitter.c (syck_scan_scalar): avoid accessingmatz
uninitialized array element. a patch from Pat Eyler <rubypate at gmail.com>. [ruby-core:07809] * array.c (rb_ary_fill): initialize local variables first. a patch from Pat Eyler <rubypate at gmail.com>. [ruby-core:07810] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-04-26* array.c (rb_ary_fill): internalize local variable "beg" tomatz
pacify Coverity. [ruby-core:07770] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-12-22* array.c: document fix - remove reference of obsoletedmatz
select usage. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-12-12* array.c (rb_ary_diff): fix a GC problem on IA64 withakr
gcc 3.3.5 (Debian 1:3.3.5-13). When rb_ary_push is called, there was no register which contains `hash' but `&RHASH(hash)->tbl' instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-11-15* array.c (rb_ary_fill): previous commit disabled this usage:ocean
a = [0,1,2,3,4,5,6,7,8,9] a.fill {|i| a[i] * 10} #=> [nil, nil, ...., nil] previous commit has advantange for early garbage collection, but potensially would break some script. so I reverted behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-11-15* array.c (rb_ary_fill): tail elements were vanished when the middleocean
part of array was filled. (ie: [0,1,2,3,4].fill(-1,2,1) => [0,1,-1]) * test/ruby/test_array.rb (test_fill): added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-11-15* array.c (rb_ary_fill): should adjust array length correctly whenmatz
an array is expanded in the fill process. [ruby-core:06625] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-11-14* array.c (rb_ary_first): RDoc update from Daniel Bergermatz
<djberg96@yahoo.com>. [ruby-core:06577]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-07-05* array.c (sort_2): get rid of yet another bcc's bug.nobu
fixed: [ruby-core:05152] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-05-13* array.c (rb_ary_select): can remove argc check. [ruby-core:4911]ocean
(patch from Daniel Berger) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-02-28* exception error messages updated. [ruby-core:04497]matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-02-23* array.c (rb_ary_s_create): no need for negative argc check.matz
[ruby-core:04463] * array.c (rb_ary_unshift_m): ditto. * lib/xmlrpc/parser.rb (XMLRPC::FaultException): make it subclass of StandardError class, not Exception class. [ruby-core:04429] * lib/open3.rb (Open3::popen3): $? should not be EXIT_FAILURE. fixed: [ruby-core:04444] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-18* process.c (proc_getpgrp): prohibit for $SAFE=2.matz
[ruby-dev:24899] * process.c (get_pid): ditto. [ruby-dev:24904] * process.c (get_ppid): ditto. * array.c (rb_ary_delete): defer rb_ary_modify() until actual modification. [ruby-dev:24901] * parse.y (newline_node): should not use FL_SET. [ruby-dev:24874] * parse.y (string_content): should not use FL_UNSET. * node.h (NODE_NEWLINE): remove unused bit to utilize flag field in nodes. * string.c (rb_str_splice): move rb_str_modify() after StringValue(), which may alter the receiver. [ruby-dev:24878] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-16* numeric.c (flo_divmod): protect float values from GC bymatz
assignment to local variables. [ruby-dev:24873] * string.c (str_mod_check): frozen check should be separated. [ruby-core:3742] * array.c (rb_ary_update): pedantic check to detect rb_ary_to_ary() to modify the receiver. [ruby-dev:24861] * string.c (rb_str_justify): typo fixed. [ruby-dev:24851] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e