mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 21:42:43 +00:00 
			
		
		
		
	UserspaceEmulator: Skip freed mallocations in reachability scan
Something being reachable from a freed mallocation doesn't make it actually reachable. Thanks to Jonas Bengtsson for spotting this! :^)
This commit is contained in:
		
							parent
							
								
									b17d175379
								
							
						
					
					
						commit
						df58ea808e
					
				
					 1 changed files with 2 additions and 0 deletions
				
			
		|  | @ -146,6 +146,8 @@ bool MallocTracer::is_reachable(const Mallocation& mallocation) const | |||
|     for (auto& other_mallocation : m_mallocations) { | ||||
|         if (&mallocation == &other_mallocation) | ||||
|             continue; | ||||
|         if (other_mallocation.freed) | ||||
|             continue; | ||||
|         size_t pointers_in_mallocation = other_mallocation.size / sizeof(u32); | ||||
|         for (size_t i = 0; i < pointers_in_mallocation; ++i) { | ||||
|             auto value = Emulator::the().mmu().read32({ 0x20, other_mallocation.address + i * sizeof(u32) }); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling