Commit graph

44421 commits

Author SHA1 Message Date
Sam Atkins
a72302342a LibWeb: Convert marker painting to new pixel units 2022-12-14 16:47:57 +00:00
Sam Atkins
fb43a71981 LibWeb: Convert shadow painting to new pixel units 2022-12-14 16:47:57 +00:00
Sam Atkins
9d1f30b533 LibWeb: Convert gradient painting to new pixel units
Co-authored-by: MacDue <macdue@dueutil.tech>
2022-12-14 16:47:57 +00:00
Sam Atkins
7c8eecbaa5 LibWeb: Convert backdrop-filter painting to new pixel units 2022-12-14 16:47:57 +00:00
Sam Atkins
0bf4089af9 LibWeb: Convert border painting to new pixel units 2022-12-14 16:47:57 +00:00
Sam Atkins
0233627545 LibWeb: Convert background painting to new pixel units 2022-12-14 16:47:57 +00:00
Sam Atkins
4440af0870 LibWeb: Split PaintContext::viewport_rect() into device/css variants
For now, everyone uses `device_viewport_rect()`, until I convert them.
2022-12-14 16:47:57 +00:00
Sam Atkins
0be479dcfb LibWeb: Make PaintContext aware of CSS and DevicePixels
Store the ratio between device and CSS pixels on the PaintContext, so
that it can convert between the two.

Co-authored-by: MacDue <macdue@dueutil.tech>
2022-12-14 16:47:57 +00:00
Sam Atkins
a3298017d6 LibWeb: Only allow DevicePixels operators to work with integers
Allowing floats here was causing accidental truncations.

Co-authored-by: MacDue <macdue@dueutil.tech>
2022-12-14 16:47:57 +00:00
Lucas CHOLLET
d3cdf151a4 Meta: Rename E2FSCK => E2FSCK_PATH
Done to increase consistency with other binaries' path.
2022-12-14 16:43:44 +00:00
Lucas CHOLLET
0fde7fe3c5 Meta: Factorize path resolution
This patch adds the `find_executable()` function that will hopefully
find executables in a distro-agnostic way and that is (hopefully as
well) easily upgradable.

The function uses some bash functionalities. So, we now require bash
for each script that includes `.shell_include.sh`.
2022-12-14 16:43:44 +00:00
Maciej
b409d3cf88 FileManager: Display message box if stat()'ing a file to activate fails 2022-12-14 15:48:25 +00:00
Maciej
569a035786 LaunchServer: Return if read_link fails in for_each_handler_for_path
Previously we were just printing error and then doing release_value(),
causing crash when opening links that cannot be read (e.g in /proc).
2022-12-14 15:48:25 +00:00
davidot
2bbea62176 LibJS: Don't update names of resulting functions in object expression
The only cases where the name should be set is if the function comes
from a direct anonymous function expression.
2022-12-14 15:27:08 +00:00
Timothy Flynn
897c7f7cc2 LibJS: Set DateTimeFormat's time zone when the CLDR download is disabled
We return early from the DateTimeFormat constructor to avoid crashing on
assertions when the CLDR is disabled. However, after commit 019211b, the
spec now mandates we assert the time zone identifier is valid. The early
return resulted in this identifier being an empty string.
2022-12-14 15:24:48 +00:00
Timothy Flynn
d382e77d38 LibUnicode: Fix compilation when the UCD download is disabled 2022-12-14 15:24:48 +00:00
MacDue
e8dbb1a8b2 PixelPaint: Add background color options to "new image" dialog
This now allows you to select a background color for your new image,
and optionally allows saving that default. You can pick between
Transparent, White, Black, or a custom color (similar to other
editors).
2022-12-14 15:23:07 +00:00
Tim Schumacher
69de709625 LibArchive: Do some error propagation while packing tar files 2022-12-14 15:20:37 +00:00
Tim Schumacher
1ec646ab94 LibArchive: Port TarOutputStream to Core::Stream 2022-12-14 15:20:37 +00:00
Tim Schumacher
9ec2cb3741 ConfigureComponents: Use Core::Stream to read output from whiptail 2022-12-14 15:19:35 +00:00
Tim Schumacher
558fab2703 LibIDL: Use Core::Stream to read imports 2022-12-14 15:19:35 +00:00
Tim Schumacher
2577bb8416 Kernel: Start implementing kmalloc_aligned more efficiently
This now only requires `size + alignment` bytes while searching for a
free memory location. For the actual allocation, the memory area is
properly trimmed to the required alignment.
2022-12-14 15:18:31 +00:00
Tim Schumacher
30a553ef80 Kernel: Check against TCP packet size overflows in checksum calculation 2022-12-14 15:17:05 +00:00
Tim Schumacher
24f956c739 Kernel: Convert TCP pseudo-headers through a union
This keeps us from tripping strict aliasing, which previously made TCP
connections inoperable when building without `-fsanitize=undefined` or
`-fno-strict-aliasing`.
2022-12-14 15:17:05 +00:00
Clemens Wasser
7cd99572be Ports: Use double quotes for a string literal in qtbase port 2022-12-14 15:12:51 +00:00
Clemens Wasser
e225c7b0de Ports: Add missing include and update renamed function in OpenJDK patch 2022-12-14 15:12:51 +00:00
Poseydon42
bdd7531bf5 AK: Create relative path even if prefix is not an ancestor of the path 2022-12-14 15:11:03 +00:00
Agustin Gianni
ac40090583 Kernel: Add the auxiliary vector to the stack size validation
This patch validates that the size of the auxiliary vector does not
exceed `Process::max_auxiliary_size`. The auxiliary vector is a range
of memory in userspace stack where the kernel can pass information to
the process that will be created via `Process:do_exec`.

The reason the kernel needs to validate its size is that the about to
be created process needs to have remaining space on the stack.
Previously only `argv` and `envp` were taken into account for the
size validation, with this patch, the size of `auxv` is also
checked. All three elements contain values that a user (or an
attacker) can specify.

This patch adds the constant `Process::max_auxiliary_size` which is
defined to be one eight of the user-space stack size. This is the
approach taken by `Process:max_arguments_size` and
`Process::max_environment_size` which are used to check the sizes
of `argv` and `envp`.
2022-12-14 15:09:28 +00:00
kleines Filmröllchen
e6a8bd1058 Base: Add a quote to the fortunes database 2022-12-14 15:07:35 +00:00
Maciej
8c082869d0 Help: Move-capture help page path
Previously it was reference-captured, causing crash because of stack
use after return.
2022-12-14 15:06:38 +00:00
Andreas Kling
6ddc358a2b Minesweeper: Make a factory function for Field and propagate errors
This fixes a pleasant 8 FIXMEs. :^)
2022-12-14 15:05:52 +00:00
Andreas Kling
cba9df1c53 CatDog: Make a factory function for CatDog and propagate errors
This fixes an astonishing 22 FIXMEs. :^)
2022-12-14 15:05:52 +00:00
Andreas Kling
ddb22cf10d Snake: Make a factory function for SnakeGame and propagate errors
This fixes a whopping 29 FIXMEs. :^)
2022-12-14 15:05:52 +00:00
Timothy Flynn
781e3aea8b LibSQL: Convert string values to a double in a locale-independent manner
This currently uses strtod, which is locale-dependent. Use the locale-
independent method added in 65ee9b4134225398f0a5109eb79b0baba98c9cd6.
2022-12-14 15:04:36 +00:00
Baitinq
88c9e4f3b0 Meta: Don't depend on sudo for privileged operations
We previously depended on sudo's specific -E flag to keep all the
environment variables when performing a privilege escalation. We now
incorporate the -E flag into the $SUDO variable, allowing for other
privilege escalation binaries (such as doas) to be used (as long as
they preserve the current environment variables).
2022-12-14 14:38:13 +00:00
Andreas Kling
7a51e846b2 Base: Add two HTML test pages for DOM cloneNode() functionality 2022-12-14 15:21:48 +01:00
Andreas Kling
b005e816a3 LibWeb: Implement Node.isEqualNode() for ProcessingInstruction nodes 2022-12-14 15:21:48 +01:00
Andreas Kling
8b0ace6289 LibWeb: Add Document.createProcessingInstruction()
These nodes don't really do anything interesting yet, but let's allow
creating them. :^)
2022-12-14 15:21:48 +01:00
Andreas Kling
bf759ce5e3 LibWeb: Make sure ProcessingInstruction objects have the right prototype 2022-12-14 15:21:48 +01:00
Andreas Kling
de2c302cdb LibWeb: Implement Node.isEqualNode() for Attr nodes 2022-12-14 15:21:48 +01:00
Andreas Kling
a004d3043f LibWeb: Implement Node.cloneNode for Attr nodes 2022-12-14 15:21:48 +01:00
Timothy Flynn
9a9c8460aa Browser: Inject cookies timestamps as integers rather than doubles
Now that LibSQL can store 64-bit integers, let's use them.
2022-12-14 09:21:30 -05:00
Timothy Flynn
72e41a7dbd LibSQL: Support 64-bit integer values and handle overflow errors
Currently, integers are stored in LibSQL as 32-bit signed integers, even
if the provided type is unsigned. This resulted in a series of unchecked
unsigned-to-signed conversions, and prevented storing 64-bit values.
Further, mathematical operations were performed without similar checks,
and without checking for overflow.

This changes SQL::Value to behave like SQLite for INTEGER types. In
SQLite, the INTEGER type does not imply a size or signedness of the
underlying type. Instead, SQLite determines on-the-fly what type is
needed as values are created and updated.

To do so, the SQL::Value variant can now hold an i64 or u64 integer. If
a specific type is requested, invalid conversions are now explictly an
error (e.g. converting a stored -1 to a u64 will fail). When binary
mathematical operations are performed, we now try to coerce the RHS
value to a type that works with the LHS value, failing the operation if
that isn't possible. Any overflow or invalid operation (e.g. bitshifting
a 64-bit value by more than 64 bytes) is an error.
2022-12-14 09:21:30 -05:00
Timothy Flynn
a1007c37a4 LibSQL: Sort the list of SQL error codes alphabetically 2022-12-14 09:21:30 -05:00
Timothy Flynn
264db4fc40 LibSQL: Remove unnecessary values from the ENUMERATE_SQL_TYPES macro
Removing the bitmask-esque values from the enumeration necessitates a
Heap version bump.
2022-12-14 09:21:30 -05:00
Timothy Flynn
b5fd96b7ac LibSQL: Ungracefully handle database version incompatibilities
In the long run, this is obviously a bad way to handle version changes
to the SQL database files. We will want to migrate old databases to new
formats. Until we figure out a good way to do that, wipe old databases
so that we don't crash trying to read incompatible data.
2022-12-14 09:21:30 -05:00
Andreas Kling
d5ed07fdc4 LibJS+LibWeb: Remove NonnullGCPtr<T>::operator=(GCPtr<T>) footgun
GCPtr can be null so it's not safe to assign it to a NonnullGCPtr unless
you know it to be non-null.

This exposed a number of wrong uses in LibWeb which had to be fixed as
part of this change.
2022-12-14 15:21:15 +01:00
Andreas Kling
4abdb68655 LibJS: Remove Object(Object& prototype) footgun
This constructor was easily confused with a copy constructor, and it was
possible to accidentally copy-construct Objects in at least one way that
we dicovered (via generic ThrowCompletionOr construction).

This patch adds a mandatory ConstructWithPrototypeTag parameter to the
constructor to disambiguate it.
2022-12-14 15:11:57 +01:00
Andreas Kling
42b5c896e8 LibJS: Don't "copy construct" temporary value in ThrowCompletionOr ctor
It was possible for the generic ThrowCompletionOr constructor to
"copy-construct" a JS Object when instantiating a ThrowCompletionOr
via e.g `return *object;`.

This happened because it chose the Object(Object& prototype) constructor
which will be removed in a subsequent commit. It was not easy to debug.

As a first step towards avoiding this in the future, the generic
ThrowCompletionOr constructor now takes the value as a const reference.
2022-12-14 15:11:57 +01:00
Arda Cinar
3ea1584f2e Presenter: Provide default text styles to text objects
Having an uninitialized text alignment value caused a crash in
Gfx::Painter::draw_text.
2022-12-14 07:45:06 -05:00