Граф коммитов

323 Коммитов

Автор SHA1 Сообщение Дата
nobu 5617e31771 symbol.c: rename rb_str_dynamic_intern
* iseq.c, marshal.c, string.c: use rb_str_intern instead of
  rb_str_dynamic_intern.
* symbol.c (rb_str_intern): rename rb_str_dynamic_intern.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-14 07:23:01 +00:00
normal a17ffebfa0 marshal.c: lazy compat_tbl allocation
In some common cases, compat_tbl is unused in dump_arg/load_arg,
so avoid malloc/free costs for the unused table.

ruby -e 'h = {a: :b}; 600000.times { Marshal.load(Marshal.dump(h)) }'

before:
	real    0m2.458s
	user    0m2.450s
	sys     0m0.006s

after:
	real    0m2.122s
	user    0m2.110s
	sys     0m0.011s

* marshal.c (w_class): check dump_arg->compat_tbl before lookup
  (w_object): lazy init ->compat_tbl before insert
  (obj_alloc_by_class): ditto
  (clear_dump_arg): free only non-NULL ->compat_tbl
  (clear_load_arg): ditto for ->compat_tbl
  (marshal_dump): ->compat_tbl defaults to zero
  (marshal_load): ditto for ->compat_tbl
  (r_entry0): check l->compat_tbl before lookup
  (r_fixup_compat): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-01 20:29:46 +00:00
nobu c47b523246 ruby.h: warn untyped Data
* include/ruby/ruby.h (rb_data_object_alloc_warning): warn
  Data_Wrap_Struct and Data_Make_Struct only if
  RUBY_UNTYPED_DATA_WARNING is set to 1.

* include/ruby/ruby.h (rb_data_object_get_warning): ditto for
  Data_Get_Struct.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-28 15:27:24 +00:00
nobu bb10a21346 ruby.h: deprecate plain Data
* include/ruby/ruby.h (rb_data_object_alloc_deprecated): deprecate
  Data_Make_Struct and Data_Wrap_Struct.  [EXPERIMENTAL]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-27 01:28:47 +00:00
nobu 360a865246 marshal.c: fix symlink index
* marshal.c (w_symbol): fix symlink index.  register the given
  symbols, not its name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-29 03:28:43 +00:00
nobu 2d1e5bcefc marshal.c: fix instance variable load odrder
* marshal.c (r_symreal): fix instance variable load odrder, its
  name must be read before its value.  the order of function call
  arguments is not stable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-28 20:36:50 +00:00
nobu 95d1b61a14 symbols instead of IDs
* encoding.c (rb_enc_get_index): deal with symbols instead of IDs
  to get rid of inadvertent pin-downs.

* enum.c (chunk_ii): ditto.

* enumerator.c (append_method): ditto.

* iseq.c (iseq_load): ditto.

* marshal.c (w_symbol, r_symlink, r_symreal, r_symbol): ditto.

* signal.c (trap_handler): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-28 08:15:42 +00:00
akr 95de2b0012 * internal.h (struct RBignum): Use size_t for len.
* include/ruby/intern.h (rb_big_new): Use size_t instead of long to
  specify the size of bignum.
  (rb_big_resize): Ditto.

* bignum.c: Follow above changes.

* rational.c: Follow above changes.

* marshal.c: Follow above changes.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-19 01:11:04 +00:00
akr 9aa67e267b * bignum.c (SIZEOF_BDIGIT): Renamed from SIZEOF_BDIGITS.
* internal.h: Ditto.

* marshal.c: Ditto.

* rational.c: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-13 03:48:17 +00:00
nobu be711df831 marshal.c: remove hack for old gcc
* marshal.c (r_object0): remove hack for old gcc, no gcc 2.x any
  more.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-12 12:58:04 +00:00
nobu 3935f2ae6e marshal.c: undumpable hidden objects
* marshal.c (w_object): internal objects are not dumpable.
  [ruby-core:61677] [Bug #9674]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26 02:20:52 +00:00
nobu dd998dd561 marshal.c: do not recycle wrapper objects
* marshal.c (marshal_dump, marshal_load): do not recycle wrapper
  objects, to prevent from segfault with continuation.
  [ruby-dev:47970] [Bug #9523]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-17 08:41:57 +00:00
normal f97051512a marshal.c: use rb_gc_force_recycle for GC-safety
Putting rb_gc_force_recycle at the end of the function has a nice
side-effect of keeping wrapper visible to GC until the moment of
recycle, preventing GC from prematurely killing live objects.
volatile is a common source of compiler bugs/differences, avoid it.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-16 03:45:15 +00:00
akr 3c99764bcd * internal.h: Rename macro names: RBIGNUM_FOO to BIGNUM_FOO.
(BIGNUM_EMBED_LEN_NUMBITS): Renamed from RBIGNUM_EMBED_LEN_NUMBITS.
  (BIGNUM_EMBED_LEN_MAX): Renamed from RBIGNUM_EMBED_LEN_MAX.
  (BIGNUM_SIGN_BIT): Renamed from RBIGNUM_SIGN_BIT.
  (BIGNUM_SIGN): Renamed from RBIGNUM_SIGN.
  (BIGNUM_SET_SIGN): Renamed from RBIGNUM_SET_SIGN.
  (BIGNUM_POSITIVE_P): Renamed from RBIGNUM_POSITIVE_P.
  (BIGNUM_NEGATIVE_P): Renamed from RBIGNUM_NEGATIVE_P.
  (BIGNUM_EMBED_FLAG): Renamed from RBIGNUM_EMBED_FLAG.
  (BIGNUM_EMBED_LEN_MASK): Renamed from RBIGNUM_EMBED_LEN_MASK.
  (BIGNUM_EMBED_LEN_SHIFT): Renamed from RBIGNUM_EMBED_LEN_SHIFT.
  (BIGNUM_LEN): Renamed from RBIGNUM_LEN.
  (RBIGNUM_DIGITS): Renamed from RBIGNUM_DIGITS.
  (BIGNUM_LENINT): Renamed from RBIGNUM_LENINT.

* bignum.c: Follow the above change.

* gc.c: Ditto.

* marshal.c: Ditto.

* math.c: Ditto.

* numeric.c: Ditto.

* random.c: Ditto.

* rational.c: Ditto.

* sprintf.c: Ditto.

* ext/-test-/bignum/bigzero.c: Ditto.

* ext/-test-/bignum/intpack.c: Ditto.

* ext/bigdecimal/bigdecimal.c: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-15 21:17:34 +00:00
hsbt 966d04da60 * marshal.c: fix typo by @xta [fix GH-533] [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-13 06:59:33 +00:00
nobu cc1910b542 marshal.c: Numerics are not tainted
* include/ruby/ruby.h (OBJ_TAINTABLE, OBJ_TAINT, OBJ_INFECT),
  marshal.c (r_entry0): all Numerics never be tainted now.
  [ruby-core:57346] [Bug #8945]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-08 17:13:55 +00:00
nobu b2b5a5db09 pack.c: hide associated objects
* marshal.c (to_be_skipped_id): ignore anonymous attributes.
* pack.c (Init_pack): use anonymous ID so that associated objects
  do not appear in the packed result.
* parse.y (rb_make_internal_id): return an anonymous ID for
  internal use.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-05 11:56:35 +00:00
nobu 5ba39a12d9 marshal.c: refine special instance variables
* marshal.c (w_obj_each, obj_count_ivars): count instance
  variables accurately.

* marshal.c (encoding_name, w_encoding): separate getting encoding
  values and writing them.

* marshal.c (w_symbol, w_ivar, w_objivar, w_object): refine
  special instance variables.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-05 08:32:11 +00:00
nobu 17a47a3358 marshal.c: preserve encoding
* marshal.c (must_not_be_anonymous, class2path): preserve encoding
  in the exception messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-05 08:24:37 +00:00
hsbt e23627c047 * marshal.c: [DOC] Wordsmith marshal.c documentation. by @vipulnsward [fix GH-470]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-09 08:51:17 +00:00
tmm1 65a564376e * marshal.c (w_object): Use HASH_PROC_DEFAULT directly from internal.h
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-23 00:46:25 +00:00
ko1 c5e08b764e * add RUBY_TYPED_FREE_IMMEDIATELY to data types which only use
safe functions during garbage collection such as xfree().
  On default, T_DATA objects are freed at same points as fianlizers.
  This approach protects issues such as reported by [ruby-dev:35578].
  However, freeing T_DATA objects immediately helps heap usage.
  Most of T_DATA (in other words, most of dfree functions) are safe.
  However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default
  for safety.
* cont.c: ditto.
* dir.c: ditto.
* encoding.c: ditto.
* enumerator.c: ditto.
* error.c: ditto.
* file.c: ditto.
* gc.c: ditto.
* io.c: ditto.
* iseq.c: ditto.
* marshal.c: ditto.
* parse.y: ditto.
* proc.c: ditto.
* process.c: ditto.
* random.c: ditto.
* thread.c: ditto.
* time.c: ditto.
* transcode.c: ditto.
* variable.c: ditto.
* vm.c: ditto.
* vm_backtrace.c: ditto.
* vm_trace.c: ditto.
* ext/bigdecimal/bigdecimal.c: ditto.
* ext/objspace/objspace.c: ditto.
* ext/stringio/stringio.c: ditto.
* ext/strscan/strscan.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29 11:16:54 +00:00
akr 2b93ed5e76 * bignum.c (MSB): Removed.
(BDIGIT_MSB): Defined using BIGRAD_HALF.
  (bary_2comp): Apply BIGLO after possible over flow of BDIGIT.
  (get2comp): Ditto.
  (bary_unpack_internal): Use BDIGIT_MSB.
  Apply BIGLO after possible over flow of BDIGIT.
  (rb_integer_unpack): Use BDIGIT_MSB.
  (calc_hbase): Use BDIGMAX.
  (big2dbl): Use BDIGMAX.
  Apply BIGLO after possible over flow of BDIGIT.
  (rb_big_neg): Apply BIGLO after possible over flow of BDIGIT.
  (biglsh_bang): Ditto.
  (bigrsh_bang): Ditto.
  (bary_divmod): Use BDIGIT_MSB.
  (bigdivrem): Ditto.
  (bigxor_int): Apply BIGLO after possible over flow of BDIGIT.

* marshal.c (shortlen): Use SIZEOF_BDIGITS instead of sizeof(BDIGIT).

* ext/openssl/ossl_bn.c (ossl_bn_initialize): Use SIZEOF_BDIGITS
  instead of sizeof(BDIGIT).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-25 03:08:23 +00:00
ko1 6a1101f23e * include/ruby/ruby.h: support write barrier protection for T_STRUCT.
Introduce the following C APIs:
  * RSTRUCT_RAWPTR(st) returns pointer (do WB on your risk).
    The type of returned pointer is (const VALUE *).
  * RSTRUCT_GET(st, idx) returns idx-th value of struct.
  * RSTRUCT_SET(st, idx, v) set idx-th value by v with WB.
  And
  * RSTRUCT_PTR(st) returns pointer with shady operation.
    The type of returned pointer is (VALUE *).
* struct.c, re.c, gc.c, marshal.c: rewrite with above APIs.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21 11:22:18 +00:00
shugo 1f828497d1 * safe.c (rb_set_safe_level, safe_setter): raise an ArgumentError
when $SAFE is set to 4.  $SAFE=4 is now obsolete.
  [ruby-core:55222] [Feature #8468]

* object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust):
  Kernel#untrusted?, untrust, and trust are now deprecated.
  Their behavior is same as tainted?, taint, and untaint,
  respectively.

* include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED()
  and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(),
  respectively.

* array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c,
  ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c,
  ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c,
  ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c,
  ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c,
  ext/socket/socket.c, ext/socket/udpsocket.c,
  ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c,
  ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c,
  load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c,
  safe.c, string.c, thread.c, transcode.c, variable.c,
  vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for
  $SAFE=4.

* test/dl/test_dl2.rb, test/erb/test_erb.rb,
  test/readline/test_readline.rb,
  test/readline/test_readline_history.rb, test/ruby/test_alias.rb,
  test/ruby/test_array.rb, test/ruby/test_dir.rb,
  test/ruby/test_encoding.rb, test/ruby/test_env.rb,
  test/ruby/test_eval.rb, test/ruby/test_exception.rb,
  test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb,
  test/ruby/test_io.rb, test/ruby/test_method.rb,
  test/ruby/test_module.rb, test/ruby/test_object.rb,
  test/ruby/test_pack.rb, test/ruby/test_rand.rb,
  test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb,
  test/ruby/test_struct.rb, test/ruby/test_thread.rb,
  test/ruby/test_time.rb: remove tests for $SAFE=4.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12 14:20:51 +00:00
akr 0c9a719d77 * internal.h (INTEGER_PACK_NEGATIVE): Defined.
(rb_integer_unpack): sign argument removed.

* bignum.c (rb_integer_unpack): sign argument removed.
  Non-negative integers generated by default.
  INTEGER_PACK_NEGATIVE flag is used to generate non-positive integers.

* pack.c (pack_unpack): Follow the above change.

* random.c (int_pair_to_real_inclusive): Ditto.
  (make_seed_value): Ditto.
  (mt_state): Ditto.
  (limited_big_rand): Ditto.

* marshal.c (r_object0): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-11 21:39:55 +00:00
akr 5a9984d7aa * marshal.c (r_object0): Use rb_integer_unpack.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-08 14:14:46 +00:00
akr 5eab13c377 * marshal.c (r_object0): Generalize a round up expression.
Use BDIGIT instead of int.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-04 15:10:28 +00:00
nobu 6db56c86c9 fill rdocs
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-02 03:12:04 +00:00
ko1 a20a14727f * hash.c, include/ruby/ruby.h: support WB protected hash.
* constify RHash::ifnone and make new macro RHASH_SET_IFNONE().
* insert write barrier for st_update().
* include/ruby/intern.h: declare rb_hash_set_ifnone(hash, ifnone).
* marshal.c (r_object0): use RHASH_SET_IFNONE().
* ext/openssl/ossl_x509name.c (Init_ossl_x509name): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-26 12:37:11 +00:00
ko1 4f401816ff * gc.c: support RGENGC. [ruby-trunk - Feature #8339]
See this ticet about RGENGC.
* gc.c: Add several flags:
* RGENGC_DEBUG: if >0, then prints debug information.
* RGENGC_CHECK_MODE: if >0, add assertions.
* RGENGC_PROFILE: if >0, add profiling features.
  check GC.stat and GC::Profiler.
* include/ruby/ruby.h: disable RGENGC by default (USE_RGENGC == 0).
* array.c: add write barriers for T_ARRAY and generate sunny objects.
* include/ruby/ruby.h (RARRAY_PTR_USE): added. Use this macro if
  you want to access raw pointers. If you modify the contents which
  pointer pointed, then you need to care write barrier.
* bignum.c, marshal.c, random.c: generate T_BIGNUM sunny objects.
* complex.c, include/ruby/ruby.h: add write barriers for T_COMPLEX
  and generate sunny objects.
* rational.c (nurat_s_new_internal), include/ruby/ruby.h: add write
  barriers for T_RATIONAL and generate sunny objects.
* internal.h: add write barriers for RBasic::klass.
* numeric.c (rb_float_new_in_heap): generate sunny T_FLOAT objects.
* object.c (rb_class_allocate_instance), range.c:
  generate sunny T_OBJECT objects.
* string.c: add write barriers for T_STRING and generate sunny objects.
* variable.c: add write barriers for ivars.
* vm_insnhelper.c (vm_setivar): ditto.
* include/ruby/ruby.h, debug.c: use two flags
  FL_WB_PROTECTED and FL_OLDGEN.
* node.h (NODE_FL_CREF_PUSHED_BY_EVAL, NODE_FL_CREF_OMOD_SHARED):
  move flag bits.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 18:07:47 +00:00
ko1 83aba04862 * include/ruby/ruby.h: constify RBasic::klass and add
RBASIC_CLASS(obj) macro which returns a class of `obj'.
  This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
* object.c: add new function rb_obj_reveal().
  This function reveal interal (hidden) object by rb_obj_hide().
  Note that do not change class before and after hiding.
  Only permitted example is:
  klass = RBASIC_CLASS(obj);
  rb_obj_hide(obj);
  ....
  rb_obj_reveal(obj, klass);
  TODO: API design. rb_obj_reveal() should be replaced with others.
  TODO: modify constified variables using cast may be harmful for
  compiler's analysis and optimizaton.
  Any idea to prohibt inserting RBasic::klass directly?
  If rename RBasic::klass and force to use RBASIC_CLASS(obj),
  then all codes such as `RBASIC(obj)->klass' will be
  compilation error. Is it acceptable? (We have similar
  experience at Ruby 1.9,
  for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)".
* internal.h: add some macros.
* RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal
  object.
* RBASIC_SET_CLASS(obj, cls) set RBasic::klass.
* RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS
  without write barrier (planned).
* RCLASS_SET_SUPER(a, b) set super class of a.
* array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c,
  file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c,
  parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c,
  string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c:
  Use above macros and functions to access RBasic::klass.
* ext/coverage/coverage.c, ext/readline/readline.c,
  ext/socket/ancdata.c, ext/socket/init.c,
* ext/zlib/zlib.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 10:49:11 +00:00
ko1 aacd771046 * *.c, parse.y, insns.def: use RARRAY_AREF/ASET macro
instead of using RARRAY_PTR().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 09:56:22 +00:00
nobu 5e79c1a543 marshal.c: no overwriting ivars
* marshal.c (copy_ivar_i): get rid of overwriting already copied
  instance variales.  c.f. [Bug #8276]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-02 08:32:48 +00:00
nobu 67b180748b marshal.c: fix marshal_load ivar
* marshal.c (r_object0): copy all instance variables not only generic
  ivars, before calling post proc.  [ruby-core:51163] [Bug #7627]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-22 08:09:44 +00:00
nobu 8c77e58b97 marshal.c: use ivars of marshal_dump data
* marshal.c (w_object): dump no ivars to the original by marshal_dump.
  [ruby-core:54334] [Bug #8276]
* marshal.c (r_object0): copy all ivars of marshal_dump data to the
  result object instead.  [ruby-core:51163] [Bug #7627]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-20 05:22:25 +00:00
nobu 1dd06612a5 marshal.c: no duplicated encoding
* marshal.c (w_object): do not dump encoding which is dumped with
  marshal_dump data.  [ruby-core:54334] [Bug #8276]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-19 04:03:29 +00:00
ngoto 82b8467e23 * marshal.c (marshal_dump, marshal_load): workaround for segv on
Intel Solaris compiled with Oracle SolarisStudio 12.3.
  Partly revert r38174. [ruby-core:52042] [Bug #7805]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-21 13:50:20 +00:00
nobu b3265c0ed6 marshal.c: check for prepended
* marshal.c (w_extended): check for prepended object.
  [ruby-core:53206] [Bug #8043]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-09 02:58:45 +00:00
nobu 0316cf2e52 marshal.c: prepended objects
* marshal.c (r_object0): load prepended objects.  treat the class of
  extended object in the included modules as prepended singleton
  class. [ruby-core:53202] [Bug #8041]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-08 15:26:08 +00:00
charliesome ba5ff937c3 * marshal.c: add security considerations to marshal overview, refer to
overview from Marshal.load documentation [#7759]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-01 15:46:10 +00:00
nobu 3fe939564f marshal.c: prohibit_ivar
* marshal.c (r_object0): prohibit setting instance variables of
  exising class/module.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-01 07:35:37 +00:00
charliesome f8823475d9 marshal.c: warn against using Marshal.load on untrusted data
* marshal.c (marshal_load): Add documentation warning against using
  Marshal.load on untrusted data [Bug #7759] [ruby-core:51765]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-31 12:55:37 +00:00
nobu 3d0786a3a8 marshal.c: marshal_dump instance varialbes
* marshal.c (w_object): dump instance varialbes of the result of
  marshal_dump not the original object.  [ruby-core:51163] [Bug #7627]
* complex.c (nucomp_marshal_dump): need to copy instance variables.
* rational.c (nurat_marshal_dump): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-26 13:39:15 +00:00
nobu 433999fd5c marshal.c: get back to the old behavior
* marshal.c (w_object, r_object0): separate respond_to checks and
  calling, and get back to the old behavior for 2.0.  [Bug #7564]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-20 14:55:42 +00:00
nobu 0fe46ceae3 marshal.c: rb_check_funcall_with_hook
* vm_eval.c (rb_check_funcall_with_hook): rb_check_funcall with hook
  which is called before calling method_missing or target method.
* marshal.c (w_object, r_object0): use rb_check_funcall_with_hook
  instead of respond_to? and call.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-23 06:05:50 +00:00
nobu 3193599d85 marshal.c: use RB_TYPE_P
* marshal.c (r_entry0): use RB_TYPE_P.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-23 05:43:04 +00:00
ngoto e90ccd3beb * marshal.c (marshal_dump, marshal_load): fix SEGV during make rdoc
and test failure in TestMarshal#test_gc and test_context_switch
  on SPARC Solaris 10 compiled with Oracle Solaris Studio 12.3.
  [Bug #7591] [ruby-dev:46772]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-19 14:47:26 +00:00
shugo 0ac361f540 * marshal.c (r_entry0): don't taint classes and modules because
Marshal.load just return the dumped classes and modules.
  [Bug #7325] [ruby-core:49198]

* test/ruby/test_marshal.rb: related test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-13 05:12:55 +00:00
nobu cfa4a59da8 marshal.c: PRIsVALUE
* marshal.c (path2class, path2module): use PRIsVALUE.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-04 07:23:34 +00:00