Upgrade to Ruby 3.1.4.

Fix ReDoS vulnerability in URI (CVE-2023-28755)
Fix ReDoS vulnerability in Time (CVE-2023-28756)

Skip a test that uses compaction when the
compaction is unimplemented.
<https://bugs.ruby-lang.org/issues/19529#note-7>
This commit is contained in:
Jarek Prokop 2023-03-31 17:33:54 +02:00
commit 2837b345ca
13 changed files with 80 additions and 212 deletions

View file

@ -139,7 +139,7 @@ diff --git a/gc.c b/gc.c
index 1c35856c44..bff0666a17 100644
--- a/gc.c
+++ b/gc.c
@@ -4984,6 +4984,23 @@ gc_unprotect_pages(rb_objspace_t *objspace, rb_heap_t *heap)
@@ -4985,6 +4985,23 @@ gc_unprotect_pages(rb_objspace_t *objspace, rb_heap_t *heap)
static void gc_update_references(rb_objspace_t * objspace);
static void invalidate_moved_page(rb_objspace_t *objspace, struct heap_page *page);
@ -163,7 +163,7 @@ index 1c35856c44..bff0666a17 100644
static void
read_barrier_handler(uintptr_t address)
{
@@ -5004,6 +5021,7 @@ read_barrier_handler(uintptr_t address)
@@ -5005,6 +5022,7 @@ read_barrier_handler(uintptr_t address)
}
RB_VM_LOCK_LEAVE();
}
@ -171,7 +171,7 @@ index 1c35856c44..bff0666a17 100644
#if defined(_WIN32)
static LPTOP_LEVEL_EXCEPTION_FILTER old_handler;
@@ -9267,13 +9285,7 @@ gc_start_internal(rb_execution_context_t *ec, VALUE self, VALUE full_mark, VALUE
@@ -9268,13 +9286,7 @@ gc_start_internal(rb_execution_context_t *ec, VALUE self, VALUE full_mark, VALUE
/* For now, compact implies full mark / sweep, so ignore other flags */
if (RTEST(compact)) {
@ -186,7 +186,7 @@ index 1c35856c44..bff0666a17 100644
reason |= GPR_FLAG_COMPACT;
}
@@ -9438,7 +9450,7 @@ gc_move(rb_objspace_t *objspace, VALUE scan, VALUE free, size_t slot_size)
@@ -9439,7 +9451,7 @@ gc_move(rb_objspace_t *objspace, VALUE scan, VALUE free, size_t slot_size)
return (VALUE)src;
}
@ -195,7 +195,7 @@ index 1c35856c44..bff0666a17 100644
static int
compare_free_slots(const void *left, const void *right, void *dummy)
{
@@ -10166,7 +10178,7 @@ gc_update_references(rb_objspace_t *objspace)
@@ -10167,7 +10179,7 @@ gc_update_references(rb_objspace_t *objspace)
gc_update_table_refs(objspace, finalizer_table);
}
@ -204,7 +204,7 @@ index 1c35856c44..bff0666a17 100644
/*
* call-seq:
* GC.latest_compact_info -> {:considered=>{:T_CLASS=>11}, :moved=>{:T_CLASS=>11}}
@@ -10207,7 +10219,7 @@ gc_compact_stats(VALUE self)
@@ -10208,7 +10220,7 @@ gc_compact_stats(VALUE self)
# define gc_compact_stats rb_f_notimplement
#endif
@ -213,7 +213,7 @@ index 1c35856c44..bff0666a17 100644
static void
root_obj_check_moved_i(const char *category, VALUE obj, void *data)
{
@@ -10286,7 +10298,7 @@ gc_compact(VALUE self)
@@ -10287,7 +10299,7 @@ gc_compact(VALUE self)
# define gc_compact rb_f_notimplement
#endif
@ -222,7 +222,7 @@ index 1c35856c44..bff0666a17 100644
/*
* call-seq:
* GC.verify_compaction_references(toward: nil, double_heap: false) -> hash
@@ -10817,7 +10829,7 @@ gc_disable(rb_execution_context_t *ec, VALUE _)
@@ -10818,7 +10830,7 @@ gc_disable(rb_execution_context_t *ec, VALUE _)
return rb_gc_disable();
}
@ -231,7 +231,7 @@ index 1c35856c44..bff0666a17 100644
/*
* call-seq:
* GC.auto_compact = flag
@@ -10831,8 +10843,7 @@ gc_disable(rb_execution_context_t *ec, VALUE _)
@@ -10832,8 +10844,7 @@ gc_disable(rb_execution_context_t *ec, VALUE _)
static VALUE
gc_set_auto_compact(VALUE _, VALUE v)
{
@ -241,7 +241,7 @@ index 1c35856c44..bff0666a17 100644
ruby_enable_autocompact = RTEST(v);
return v;
@@ -10841,7 +10852,8 @@ gc_set_auto_compact(VALUE _, VALUE v)
@@ -10842,7 +10853,8 @@ gc_set_auto_compact(VALUE _, VALUE v)
# define gc_set_auto_compact rb_f_notimplement
#endif
@ -251,7 +251,7 @@ index 1c35856c44..bff0666a17 100644
/*
* call-seq:
* GC.auto_compact -> true or false
@@ -13714,11 +13726,21 @@ Init_GC(void)
@@ -13753,11 +13776,21 @@ Init_GC(void)
rb_define_singleton_method(rb_mGC, "malloc_allocated_size", gc_malloc_allocated_size, 0);
rb_define_singleton_method(rb_mGC, "malloc_allocations", gc_malloc_allocations, 0);
#endif
@ -278,7 +278,7 @@ index 1c35856c44..bff0666a17 100644
#if GC_DEBUG_STRESS_TO_CLASS
rb_define_singleton_method(rb_mGC, "add_stress_to_class", rb_gcdebug_add_stress_to_class, -1);
@@ -13742,6 +13764,7 @@ Init_GC(void)
@@ -13781,6 +13803,7 @@ Init_GC(void)
OPT(MALLOC_ALLOCATED_SIZE);
OPT(MALLOC_ALLOCATED_SIZE_CHECK);
OPT(GC_PROFILE_DETAIL_MEMORY);