mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 12:12:45 +00:00 
			
		
		
		
	LibGfx: Don't assume that image decoder plugin creation succeeds
An image with an incorrect header should fail at this step, so we have to handle that without crashing.
This commit is contained in:
		
							parent
							
								
									074ea60bb6
								
							
						
					
					
						commit
						7b72bf2910
					
				
					 1 changed files with 5 additions and 3 deletions
				
			
		|  | @ -48,9 +48,11 @@ static OwnPtr<ImageDecoderPlugin> probe_and_sniff_for_appropriate_plugin(Readonl | |||
|         auto sniff_result = plugin.sniff(bytes); | ||||
|         if (!sniff_result) | ||||
|             continue; | ||||
|         auto plugin_decoder = plugin.create(bytes).release_value_but_fixme_should_propagate_errors(); | ||||
|         if (!plugin_decoder->initialize().is_error()) | ||||
|             return plugin_decoder; | ||||
|         auto plugin_decoder = plugin.create(bytes); | ||||
|         if (!plugin_decoder.is_error()) { | ||||
|             if (!plugin_decoder.value()->initialize().is_error()) | ||||
|                 return plugin_decoder.release_value(); | ||||
|         } | ||||
|     } | ||||
|     return {}; | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lucas CHOLLET
						Lucas CHOLLET