Commit graph

44256 commits

Author SHA1 Message Date
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
Arda Cinar
9d9a6b6b64 Presenter: Fix a crash in loading untitled presentations
The Presentation::title() and Presentation::author() functions return a
StringView to the title/author defined in the json file or a default
value. Previously, this would return a StringView to already-freed
memory and crash the application when setting the window title. This
commit fixes that issue :^)
2022-12-14 07:45:06 -05:00
Timothy Flynn
e305b32d9a LibCore: Protect Core::Group against null group::gr_mem members
Serenity's implementation does not set this pointer to anything, so we
should not assume it was set.
2022-12-14 07:25:36 -05:00
Timothy Flynn
d09266237d LibCore: Define and use a fallible, OS-independent getgrent(_r) wrapper
Rather than maintaining a list of #ifdef guards to check systems that do
not provide the reentrant version of getgrent, we can use C++ concepts
to let the compiler perform this check for us.

While we're at it, we can also provide this wrapper as fallible to let
the caller TRY calling it.
2022-12-14 07:25:36 -05:00
Timothy Flynn
1ee808fae6 LibCore: Define and use a fallible, OS-independent getpwent(_r) wrapper
Rather than maintaining a list of #ifdef guards to check systems that do
not provide the reentrant version of getpwent, we can use C++ concepts
to let the compiler perform this check for us.

While we're at it, we can also provide this wrapper as fallible to let
the caller TRY calling it.
2022-12-14 07:25:36 -05:00
Ali Mohammad Pur
b367da592c AK: Bring back the AK_DONT_REPLACE_STD #define
This was removed in a910961f37d1da9dafb6385e348266746354cf98 in favour
of the more general USING_AK_GLOBALLY #define, but Ladybird (and
probably other projects) depend on the smaller hammer to include STL
headers and keep the USING_AK_GLOBALLY behaviour, so put it back and
preserve its behaviour.
2022-12-14 12:56:01 +01:00
Andrew Kaster
16d4791212 CMake: Pass NO_POLICY_SCOPE to options cmake helpers
Tell CMake to not create a new policy scope for the
(lagom|serenity|common)_options.cmake helpers, and lets us set common
policies for both projects in common_options.cmake that actually apply
to the rest of the project, instead of just common_options.cmake itself.
2022-12-14 12:43:12 +01:00
Ali Mohammad Pur
f96a3c002a Everywhere: Stop shoving things into ::std and mentioning them as such
Note that this still keeps the old behaviour of putting things in std by
default on serenity so the tools can be happy, but if USING_AK_GLOBALLY
is unset, AK behaves like a good citizen and doesn't try to put things
in the ::std namespace.

std::nothrow_t and its friends get to stay because I'm being told that
compilers assume things about them and I can't yeet them into a
different namespace...for now.
2022-12-14 11:44:32 +01:00
Ali Mohammad Pur
72514d6915 AK: Make Types.h not export its functions if !USING_AK_GLOBALLY 2022-12-14 11:44:32 +01:00
Linus Groh
b90f505409 LibJS: Convert WrappedFunction::create() to NonnullGCPtr 2022-12-14 09:59:45 +00:00
Linus Groh
54ebf71da2 LibJS: Convert WeakSet::create() to NonnullGCPtr 2022-12-14 09:59:45 +00:00
Linus Groh
cac71a6847 LibJS: Convert WeakRef::create() to NonnullGCPtr 2022-12-14 09:59:45 +00:00
Linus Groh
3358ddfd0e LibJS: Convert WeakMap::create() to NonnullGCPtr 2022-12-14 09:59:45 +00:00
Linus Groh
37c85fa07e LibJS: Convert TypedArray::create() to NonnullGCPtr 2022-12-14 09:59:45 +00:00
Linus Groh
dd3d133968 LibJS: Convert SymbolObject::create() to NonnullGCPtr 2022-12-14 09:59:45 +00:00
Linus Groh
049e99b5f0 LibJS: Convert StringObject::create() to NonnullGCPtr 2022-12-14 09:59:45 +00:00