mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 13:20:59 +00:00 
			
		
		
		
	AK: Replace the mutable String::replace API with an immutable version
This removes the awkward String::replace API which was the only String
API which mutated the String and replaces it with a new immutable
version that returns a new String with the replacements applied. This
also fixes a couple of UAFs that were caused by the use of this API.
As an optimization an equivalent StringView::replace API was also added
to remove an unnecessary String allocations in the format of:
`String { view }.replace(...);`
			
			
This commit is contained in:
		
							parent
							
								
									aba4c9579f
								
							
						
					
					
						commit
						6704961c82
					
				
				
				Notes:
				
					sideshowbarker
				
				2024-07-18 04:15:01 +09:00 
				
			
			Author: https://github.com/IdanHo
Commit: 6704961c82
Pull-request: https://github.com/SerenityOS/serenity/pull/9948
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/bgianfo ✅
			
					 26 changed files with 72 additions and 118 deletions
				
			
		|  | @ -201,7 +201,7 @@ static void parse_special_casing(Core::File& file, UnicodeData& unicode_data) | |||
| 
 | ||||
|             if (!casing.locale.is_empty()) | ||||
|                 casing.locale = String::formatted("{:c}{}", to_ascii_uppercase(casing.locale[0]), casing.locale.substring_view(1)); | ||||
|             casing.condition.replace("_", "", true); | ||||
|             casing.condition = casing.condition.replace("_", "", true); | ||||
| 
 | ||||
|             if (!casing.condition.is_empty() && !unicode_data.conditions.contains_slow(casing.condition)) | ||||
|                 unicode_data.conditions.append(casing.condition); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Idan Horowitz
						Idan Horowitz