1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:37:35 +00:00

LibPDF: Implement ICCBasedColorSpace::number_of_components()

We now no longer crash on images that use an ICC-based color space.
Reduces number of crashes on 300 random PDFs from the web (the first 300
from 0000.zip from
https://pdfa.org/new-large-scale-pdf-corpus-now-publicly-available/)
from 81 (27%) to 64 (21%).

Also fixes all remaining crashes in
411_getting_started_with_instruments.pdf and
513_high_efficiency_image_file_format.pdf.
This commit is contained in:
Nico Weber 2023-10-19 21:54:34 -04:00 committed by Andreas Kling
parent f5d3f47af3
commit 33443f7991
2 changed files with 6 additions and 1 deletions

View file

@ -354,6 +354,11 @@ PDFErrorOr<Color> ICCBasedColorSpace::color(Vector<Value> const& arguments) cons
return Color(output[0], output[1], output[2]);
}
int ICCBasedColorSpace::number_of_components() const
{
return Gfx::ICC::number_of_components_in_color_space(m_profile->data_color_space());
}
Vector<float> ICCBasedColorSpace::default_decode() const
{
auto color_space = m_profile->data_color_space();