mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:12:43 +00:00 
			
		
		
		
	LibGfx: Make all image decoders reject image sizes above 16384 pixels
Let's just say no to shenanigans by capping images at 16384 pixels both wide and tall. If a day comes in the future where we need to handle images larger than this, we can deal with it then.
This commit is contained in:
		
							parent
							
								
									a5f4cb78cf
								
							
						
					
					
						commit
						edf01803cd
					
				
					 7 changed files with 38 additions and 10 deletions
				
			
		|  | @ -518,6 +518,11 @@ static bool decode_bmp_core_dib(BMPLoadingContext& context, Streamer& streamer) | |||
|         return false; | ||||
|     } | ||||
| 
 | ||||
|     if (static_cast<size_t>(core.width) > maximum_width_for_decoded_images || static_cast<size_t>(abs(core.height)) > maximum_height_for_decoded_images) { | ||||
|         dbgln("This BMP is too large for comfort: {}x{}", core.width, abs(core.height)); | ||||
|         return false; | ||||
|     } | ||||
| 
 | ||||
|     auto color_planes = streamer.read_u16(); | ||||
|     if (color_planes != 1) { | ||||
|         IF_BMP_DEBUG(dbg() << "BMP has an invalid number of color planes: " << color_planes); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling