mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	[Bug #18382] Fix crash in compaction for ObjectSpace.trace_object_allocations
ObjectSpace.trace_object_allocations can crash when auto-compaction is enabled.
This commit is contained in:
		
							parent
							
								
									fbc1615761
								
							
						
					
					
						commit
						9f0c6f20c5
					
				
				
				Notes:
				
					git
				
				2021-12-03 03:07:05 +09:00 
				
			
			
			
		
		
					 1 changed files with 2 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -208,7 +208,8 @@ allocation_info_tracer_compact(void *ptr)
 | 
			
		|||
{
 | 
			
		||||
    struct traceobj_arg *trace_arg = (struct traceobj_arg *)ptr;
 | 
			
		||||
 | 
			
		||||
    if (st_foreach_with_replace(trace_arg->object_table, hash_foreach_should_replace_key, hash_replace_key, 0)) {
 | 
			
		||||
    if (trace_arg->object_table &&
 | 
			
		||||
            st_foreach_with_replace(trace_arg->object_table, hash_foreach_should_replace_key, hash_replace_key, 0)) {
 | 
			
		||||
        rb_raise(rb_eRuntimeError, "hash modified during iteration");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue