mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 14:02:46 +00:00 
			
		
		
		
	LibGfx: Accept BMP RLE of 255 repeated bytes
Previously, in the case of RLE4, parsing took suspiciously long. What happened was that 'pixel_count' was 255, and 'i' was incremented by *two* in each iteration, so the for-loop continued until the entire output buffer was full, and then rejected the RLE data as bogus. This little diff allows pixel_count to reach 256, be greater than pixel_count, and thus terminate the loop in the intended way.
This commit is contained in:
		
							parent
							
								
									21977a2188
								
							
						
					
					
						commit
						aec8983819
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		|  | @ -1059,7 +1059,7 @@ static bool uncompress_bmp_rle_data(BMPLoadingContext& context, ByteBuffer& buff | |||
|             if (!result.has_value()) | ||||
|                 return false; | ||||
|             byte = result.value(); | ||||
|             for (u8 i = 0; i < pixel_count; ++i) { | ||||
|             for (u16 i = 0; i < pixel_count; ++i) { | ||||
|                 if (compression != Compression::RLE4) { | ||||
|                     if (!set_byte(byte, true)) | ||||
|                         return false; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Ben Wiederhake
						Ben Wiederhake