Ben Wiederhake
031814796e
LibGfx: Recognize incomplete BMP colormaps
2020-12-02 10:46:40 +01:00
Ben Wiederhake
a4b207e04f
LibGfx: Mark static method as static
2020-12-02 10:46:40 +01:00
Nico Weber
eef30bb05e
LibGfx: Add some validation to BMPLoader
...
These changes fixed various asserts when I ran the fuzzer locally a
while ago.
2020-12-01 16:48:22 +01:00
Ben Wiederhake
f82b2948cf
Meta: Fix BMP_DEBUG, and always build on CI
2020-12-01 11:06:53 +01:00
AnotherTest
b2d698472b
LibGfx: Add a 'Point::absolute_relative_distance_to(Point)'
...
This is significantly more elegant than subtracting the points and
constructing another point from the abs() of their individual
components.
2020-11-30 12:07:45 +01:00
devashish
2a332d8669
JPGLoader: Use HashMap to store huffman tables
...
This patch rids us of the ugly hack that we had to go through while
handling table redefinitons.
2020-11-30 11:37:51 +01:00
Nico Weber
34c5478f31
LibGfx: Validate bit depths, and don't assert on invalid color type
...
The PNG spec says that each color type only allows certain bit depths,
so add explicit checks for that.
2020-11-29 21:28:44 +01:00
Nico Weber
fe999d6281
LibGfx: Make PNGLoader not assert on images with missing chunks
...
Before this, images without IHDR, or palettized images with no or
too small PLTE would lead to asserts. Found by running FuzzPNGLoader
locally.
2020-11-29 21:28:44 +01:00
Nico Weber
7db765bb73
LibGfx: Put debug output in PNGLoader behind PNG_DEBUG
2020-11-29 21:28:44 +01:00
Luke
d7455018eb
LibGfx: gamma_to_linear4 is not a valid constexpr on clang 10 and below
...
This is a hack which can be removed once GitHub Actions changes the
default version to clang 11.
This is apparently sometime in mid-December.
Note, clang-11 is not currently available on Ubuntu 20.04. However,
GitHub Actions uses 20.04, which probably means clang-11 will
become available around that time for all 20.04 users.
2020-11-29 20:22:56 +01:00
Nico Weber
1f22a59f9d
LibGfx: Don't assert on files ending right before lzw_min_code_size
...
Not yet found by oss-fuzz, but I hit it a while ago when running
FuzzGIFLoader locally.
2020-11-29 20:21:30 +01:00
Nico Weber
86cec77eb5
LibGfx: skip zero-width frames
...
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27913
and https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27873
2020-11-29 20:21:30 +01:00
devashish
4d7ba50dc7
JPGLoader: Move bogus JPEGs to a different directory
2020-11-29 16:22:04 +01:00
devashish
f107c70652
JPGLoader: Use HashMap instead of Vector for storing components
...
The JPEG spec allows component IDs to be chosen arbitrarily from the
interval [0, 255]. Storing components in a vector corrupts the decoder
when component IDs are not in the range 0-3. Normally, encoders don't
use IDs outside of that range because JPEG doesn't support more than
4 channels. But since there is a chance that a spec compliant JPEG
would have component IDs outside of [0-3], we should consider replacing
the vector, which enforces serial component access based on component
IDs, with a HashMap<u8, ComponentSpec>.
2020-11-29 16:22:04 +01:00
Nico Weber
ec4c2f971b
Lagom: Make BMP fuzzer look like the other image loader fuzzers
2020-11-26 09:59:46 +01:00
BenJilks
216385084b
LibGfx: Add BMPWriter
...
This utility allows you to create a BMP file from a bitmap
2020-11-22 16:07:00 +01:00
Nico Weber
700fe315cf
LibGfx: Make some GIFLoader magic numbers a bit less magic
...
No behavior change.
2020-11-20 21:17:58 +01:00
Nico Weber
967c82c1be
LibGfx: Put GIFLoader logging behind GIF_DEBUG
2020-11-20 21:17:58 +01:00
Nico Weber
ebfc21509a
LibGfx: De-constexpr Gamma.h
...
__builtin_sqrtf() isn't constexpr in clang.
2020-11-20 21:17:58 +01:00
Sahan Fernando
1b9a85e4f1
LibGfx: Use gamma-corrected interpolation for color gradients
...
Switch over to gamma-aware interpolation. This causes color gradients
to not look so dark in the middle. SIMD optimized code is provided for
sse1 enabled builds.
Fixes #1342 .
2020-11-19 21:24:20 +01:00
Nico Weber
7042490e41
LibGfx: Bounds check component indices before using them in JPGLoader
...
With this, I don't see any crashes in 10 min of fuzzing (but still
get OOMs).
2020-11-19 21:21:45 +01:00
Nico Weber
a8318b15a7
LibGfx: Check for read failures after every read in jpg loader
...
This doesn't fix all the issues found by the fuzzer, but it fixes
many of them. When running this
Meta/Lagom/Fuzzers/FuzzJPGLoader -jobs=24 -workers=24 \
../Base/res/html/misc/jpgsuite_files/
for 10 minutes on my machine, the fuzzer foudn 2 crashers, but after
this change it finds just ... 2. But with different stacks!
This just fixes ASSERT()s, so it's not security critical, but
ASSERT()s still crash the programs decoding JPGs, and crashing
less is nice even if it's not a security concern.
2020-11-19 21:21:45 +01:00
Nico Weber
129a0666cb
LibGfx: Put remaining jpg logging behind JPG_DEBUG
...
...except for one happy-case log line which is removed wholesale.
2020-11-19 21:21:45 +01:00
Nico Weber
3749e167b4
LibGfx: Move JPGLoader to a more regular JPG_DEBUG macro as used elsewhere
2020-11-19 21:21:45 +01:00
Nico Weber
9ea709e1f3
LibGfx: Put PPM logs behind (default-off) PPM_DEBUG
2020-11-19 14:04:35 +01:00
Andreas Kling
9ffdb71111
LibGfx: Don't leak malloc memory in cloned fonts
...
Fixes #4083 .
2020-11-15 11:35:07 +01:00
Linus Groh
5b68ea8dde
LibGfx: Make Bitmap path handling case insensitive
...
Bitmap::is_path_a_supported_image_format() and Bitmap::load_from_file()
now check the file extension with CaseSensitivity::CaseInsensitive.
This fixes a couple of inconsistencies, for example would
FileSystemModel::icon_for() recognize image files uppercase extensions
but couldn't create thumbnails for them (any attempt to create a bitmap
from such files would fail).
2020-11-14 10:11:26 +01:00
Andreas Kling
69518bd178
LibGfx: Fail PPM decode if there's not enough pixel data in the input
...
Fixes #3820 .
2020-11-13 12:01:32 +01:00
Andreas Kling
f234b8c129
LibGfx: Add missing stream error handling in GIF frame descriptor parse
...
If we try to read a sentinel byte but the stream is fresh out of data,
we have to take care of the stream error and bail out right away, or
we'll hit an assertion when exiting the function soon after.
Fixes #3486 .
2020-11-13 12:01:29 +01:00
Andreas Kling
c0aa455f76
LibGfx: Refuse to decode PNG images with geometry outside i32 bounds
...
Just fail the decode immediately when encountering an IHDR chunk with
width and/or height larger than the maximum i32 value.
Fixes #3818 .
Fixes #3819 .
2020-11-13 12:01:25 +01:00
AnotherTest
705ad670f3
LibGfx: Add methods to serialise and deserialise a Bitmap
...
Unlike `to_shared_buffer()` and co, these methods do *not* require extra
metadata about the bitmap.
2020-11-08 21:46:13 +01:00
Peter Nelson
e23daa90a3
LibGfx: remove debug printfs from GIFLoader
2020-11-08 21:40:47 +01:00
Peter Nelson
fa57083552
LibGfx: gracefully handle GIFs with frame decode errors
...
GIFLoader now tracks the state of errors during the decoding process
and will fall back to displaying the first frame of the GIF if any of
the subsequent frames fail to decode.
2020-11-08 21:40:47 +01:00
Andreas Kling
508063ef85
LibGfx: Remove debug spam about successful font lookups
2020-11-07 14:23:31 +01:00
Andreas Kling
70eaadc1cd
LibGfx: Load the system default fonts by name
...
Instead of loading them by absolute path, that is.
2020-11-04 21:21:52 +01:00
Brendan Coles
fb5ea8a212
WindowServer+LibGfx: Add Gfx::StandardCursor::Hidden cursor
2020-11-02 20:58:07 +01:00
Andreas Kling
ee21a724c7
LibGfx: Add some more assertions to Gfx::Bitmap
...
Let's also be paranoid about get_pixel() since we started worrying
about set_pixel(). :^)
2020-11-02 11:01:00 +01:00
Peter Nelson
23c4f1a3d4
LibGfx: assert Bitmap::set_pixel does not write out of bounds
2020-11-01 20:13:25 +01:00
Peter Nelson
5567408bab
LibGfx: add bounds checking before set_pixel call in GIF decoder
...
This fixes a crash when a GIF frame extends beyond the limits of the
logical screen, causing writes past the end of the frame buffer
2020-11-01 20:13:25 +01:00
Andreas Kling
982e066100
LibGfx: Move FontDatabase from LibGUI to LibGfx
...
Not sure why I put this into LibGUI in the first place.
2020-10-31 13:56:21 +01:00
Uma Sankar Yedida
9ccae7a908
WindowServer+LibGfx: Added Crosshair cursor
2020-10-30 19:10:15 +01:00
Andreas Kling
3ec19ae4b6
LibGUI+LibGfx+WindowServer: Auto-generate disabled action icons :^)
...
This patch adds a simple filter that makes button and menu item icons
have that "'90s disabled" look when disabled. It's pretty awesome.
2020-10-27 21:25:40 +01:00
Andreas Kling
b7dfa83223
LibGUI+LibGfx: Improve focus rect appearance
...
Draw a dotted focus rect to make it stand out more. Also make it much
larger on regular text-only GUI::Buttons.
2020-10-26 21:01:45 +01:00
Nico Weber
63dcd59fa5
LibGfx: Make Color formattable
2020-10-26 18:55:36 +01:00
Andreas Kling
9d347352a1
LibGfx+LibGUI+Clients: Make fonts findable by their qualified name
...
The qualified name of a font is "<Family> <Size> <Weight>". You can
get the QN of a Font via the Font::qualified_name() API, and you can
get any system font by QN from the GUI::FontDatabase. :^)
2020-10-25 21:18:18 +01:00
Andreas Kling
b1eeb15129
LibGfx: Handle TextAlignment::BottomRight in do_draw_text()
2020-10-25 11:50:38 +01:00
Andreas Kling
80b77cec38
LibGfx+FontEditor+Fonts: Add family, size and weight metadata to fonts
...
This makes finding fonts from the same family much less difficult. :^)
2020-10-25 10:12:03 +01:00
Andreas Kling
5abc03db0d
Fonts: Rename font files consistently
...
Font files are now all named like this:
<Family><Weight><Size>.font
This will make it much easier/sane to perform font lookup.
2020-10-25 10:12:03 +01:00
Andreas Kling
20ca3d4a99
LibGfx+WindowServer: Handle taller window title fonts better
...
If the window title font is taller than the theme's specified title
height, compute the title height based on the font instead. :^)
2020-10-24 00:26:13 +02:00
Andreas Kling
3c5da01f94
LibGUI+LibGfx+Base: Make tooltips color theme aware :^)
...
Also tweak the default tooltip color to be more bright and yellow!
2020-10-23 12:01:14 +02:00