MacDue
bbf66ea055
LibGfx: Remove maximum size limit for decoded images
...
It is unlikely this is needed anymore, and as pointed out things should
now safely return OOM if the bitmap is too large to allocate.
Also, no recently added decoders respected this limit anyway.
Fixes #20872
2023-09-03 14:36:54 +02:00
Lucas CHOLLET
9ff706339b
LibGfx/PortableFormat: Read the header during initialization
...
This is done as a part of #19893 .
2023-07-11 14:16:33 +01:00
Lucas CHOLLET
f3ff9c26bc
LibGfx/PortableFormat: Simplify the State enum
...
This enum used to store very precise state about the decoding process,
let's simplify that by only including two steps: HeaderDecoder and
BitmapDecoded.
2023-07-11 14:16:33 +01:00
Lucas CHOLLET
f6ce06d56b
LibGfx/PortableFormat: Extract header reading in its own function
2023-07-11 14:16:33 +01:00
Lucas CHOLLET
d00a563462
LibGfx/PortableFormat: Write directly to the bitmap
...
No need to copy the data first to a Vector and then to the Bitmap. We
can skip this unnecessary step.
2023-06-22 21:32:45 +02:00
Lucas CHOLLET
b78622ddf7
LibGfx/PortableFormat: Reject images with a maximum value of 0
...
These images can't contain any meaningful information, so no need to try
to decode them. Doing so result in a `SIGFPE`, as we divide by this
value later on.
Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=57434&sort=-opened&can=1&q=proj%3Aserenity
2023-06-06 23:48:52 +02:00
Ben Wiederhake
560133a0c6
Everywhere: Remove unused DeprecatedString includes
2023-04-09 22:00:54 +02:00
Lucas CHOLLET
fd04b2dc9b
LibGfx/PortableFormat: Propagate errors from decode()
2023-03-24 10:56:58 +01:00
Lucas CHOLLET
7ec310384a
LibGfx/PortableFormat: Propagate errors from read_image_data()
2023-03-24 10:56:58 +01:00
Lucas CHOLLET
2356b48f13
LibGfx/PortableFormat: Propagate errors from read_magic_number()
2023-03-24 10:56:58 +01:00
Lucas CHOLLET
7cafd7d177
LibGfx/PortableFormat: Port to Stream
...
Each one of `[PBM, PGM, PPM]Loader` used yet another stream-like relic.
This patch ports all of them to `AK::Stream`.
2023-03-24 10:56:58 +01:00
Lucas CHOLLET
4554d10fe5
LibGfx: Remove unused functions load_from_memory
and load_impl
2023-03-24 10:56:58 +01:00
Lucas CHOLLET
05e6ed6ecb
LibGfx/PortableFormat: Propagate errors from some read_*
functions
...
These functions are:
- read_width
- read_height
- read_max_val
2023-03-24 10:56:58 +01:00
Lucas CHOLLET
bab2113ec1
LibGfx/PortableFormat: Make read_whitespace
return an ErrorOr
2023-03-24 10:56:58 +01:00
Lucas CHOLLET
74f893e9f4
LibGfx/PortableFormat: Make read_comment
return an ErrorOr
2023-03-24 10:56:58 +01:00
Lucas CHOLLET
964172754e
LibGfx/PortableFormat: Don't accept comments that don't start with #
2023-03-24 10:56:58 +01:00
Lucas CHOLLET
9052a6febf
LibGfx/PortableFormat: Simplify read_number
signature
...
The function signature goes from:
`bool read_number(Streamer& streamer, TValue* value)`
to
`ErrorOr<u16> read_number(Streamer& streamer)`
It allows us to, on one hand use `ErrorOr` for error propagation,
removing an out parameter in the meantime, and on the other hand remove
the useless template.
2023-03-24 10:56:58 +01:00
Lucas CHOLLET
496b7ffb2b
LibGfx: Move all image loaders and writers to a subdirectory
2023-03-21 22:39:25 +01:00