mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:07:34 +00:00
LibGfx/JPEG: Reject ycck or cmyk jpegs with k subsampled for now
The decoder assumes that k's sampling factor matches y's at the moment. Better to error out than to silently render something broken. For ycck, covered by ycck-2111.jpg in the tests.
This commit is contained in:
parent
3c7abe22ca
commit
9c5a75067f
1 changed files with 1 additions and 1 deletions
|
@ -1287,7 +1287,7 @@ static ErrorOr<void> read_start_of_frame(JPEGStream& stream, JPEGLoadingContext&
|
|||
bool channel_matches_y_factor = component.hsample_factor == y_component.hsample_factor && component.vsample_factor == y_component.vsample_factor;
|
||||
bool k_channel_matches_y = context.color_transform == ColorTransform::YCCK && i == 3 && channel_matches_y_factor;
|
||||
|
||||
if ((component.hsample_factor != 1 || component.vsample_factor != 1) && !k_channel_matches_y) {
|
||||
if (((component.hsample_factor != 1 || component.vsample_factor != 1) && !k_channel_matches_y) || (i == 3 && !channel_matches_y_factor)) {
|
||||
dbgln_if(JPEG_DEBUG, "Unsupported chroma subsampling factors: horizontal: {}, vertical: {}",
|
||||
component.hsample_factor,
|
||||
component.vsample_factor);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue