1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:48:11 +00:00

LibGfx: Add the start of a JBIG2 loader

JBIG2 is infamous for two things:

1. It's used in xerox scanners were it falsifies scanned numbers:

https://www.dkriesel.com/en/blog/2013/0802_xerox-workcentres_are_switching_written_numbers_when_scanning

2. It was allegedly used in an iOS zero day, in a very cool way:

https://googleprojectzero.blogspot.com/2021/12/a-deep-dive-into-nso-zero-click.html

Needless to say, we need support for it in Serenity. (...because it's
used in PDF files.)

This adds all the scaffolding, but no actual implementation yet.

It's enough for `file` to print the mime type of .jb2 files, but `image`
can't do anything with the files yet.
This commit is contained in:
Nico Weber 2024-03-03 09:21:30 -05:00 committed by Andreas Kling
parent d7ad134ae5
commit 58838db445
12 changed files with 86 additions and 22 deletions

View file

@ -11,6 +11,7 @@
#include <LibGfx/ImageFormats/ICOLoader.h>
#include <LibGfx/ImageFormats/ILBMLoader.h>
#include <LibGfx/ImageFormats/ImageDecoder.h>
#include <LibGfx/ImageFormats/JBIG2Loader.h>
#include <LibGfx/ImageFormats/JPEGLoader.h>
#include <LibGfx/ImageFormats/JPEGXLLoader.h>
#include <LibGfx/ImageFormats/PAMLoader.h>
@ -39,6 +40,7 @@ static ErrorOr<OwnPtr<ImageDecoderPlugin>> probe_and_sniff_for_appropriate_plugi
{ GIFImageDecoderPlugin::sniff, GIFImageDecoderPlugin::create },
{ ICOImageDecoderPlugin::sniff, ICOImageDecoderPlugin::create },
{ ILBMImageDecoderPlugin::sniff, ILBMImageDecoderPlugin::create },
{ JBIG2ImageDecoderPlugin::sniff, JBIG2ImageDecoderPlugin::create },
{ JPEGImageDecoderPlugin::sniff, JPEGImageDecoderPlugin::create },
{ JPEGXLImageDecoderPlugin::sniff, JPEGXLImageDecoderPlugin::create },
{ PAMImageDecoderPlugin::sniff, PAMImageDecoderPlugin::create },