Commit graph

30276 commits

Author SHA1 Message Date
Ben Wiederhake 768915bbcd LibGUI: Make clipboard bitmap parsing more robust
In particular, malicious programs used to be able to set arbitrary
values as "format", which could cause UB (most likely a crash).

Furthermore, we do not transmit palette data, so an application sending
an indexed bitmap cannot possibly expect the other side to receive a
useful image. Therefore, we refuse to build a bitmap.
2021-11-21 11:49:06 +00:00
Ben Wiederhake d6c686e8bf ClipboardHistory: Properly display bitmap depth 2021-11-21 11:49:06 +00:00
Ben Wiederhake f22c0ffe0c LibGUI+Everywhere: Make sync requests to Clipboard server more obvious 2021-11-21 11:49:06 +00:00
Ben Wiederhake 06f140a025 LibGUI: Avoid access to Clipboard server, clipboard text is never empty
The clipboard cannot reasonably contain the empty string. The clipboard
can be empty (i.e. cleared), sure, but that this check was about whether
the clipboard contained the empty string.

This cannot easily happen for two reasons:
- TextEditor GUI elements disable their copy actions when the selection
  is empty.
- Clipboard::set_data, through which all text-copying operates,
  implicitly forbids empty strings, because Process::sys$anon_create
  forbids empty anonymous files.
- Even if it were sent (e.g. by creating a non-empty anonymous file and
  sending it manually to the Clipboard server), it would not be
  received, because decode(Decoder&, Core::AnonymousBuffer&) goes
  through mmap() with a size of 0, which also is forbidden by the
  Kernel.

In other words, if the clipboard is never the empty text, therefore
checking this condition is pointless, and we can save a roundtrip to the
Clipboard server.
2021-11-21 11:49:06 +00:00
Ben Wiederhake c80dcc4671 LibGUI: Make paste access to Clipboard atomic
This avoids data race issues and saves a synchronous request to the
ClipboardServer.
2021-11-21 11:49:06 +00:00
Ben Wiederhake 81128c5100 Browser: Make paste access to Clipboard atomic
This avoids data race issues and saves a synchronous request to the
ClipboardServer.
2021-11-21 11:49:06 +00:00
Ben Wiederhake d29f094ffa FontEditor: Make paste access to Clipboard atomic
This avoids data race issues and saves three out of four synchronous
requests to the ClipboardServer.
2021-11-21 11:49:06 +00:00
Ben Wiederhake ff17f6877a LibVT: Make paste access to Clipboard atomic
This avoids data race issues and saves a synchronous request to
ClipboardServer.
2021-11-21 11:49:06 +00:00
Ben Wiederhake b6419f2cf2 LibGUI: Make clipboard-as-bitmap parsing less data-race-y
This encourages the caller to first fetch data and type atomically, and
then parse that, instead of potentially making multiple requests.
2021-11-21 11:49:06 +00:00
Jelle Raaijmakers 55526634b6 Piano: Use default sample rate in absence of audio device 2021-11-21 09:27:00 +01:00
Jelle Raaijmakers 87e4abb4c7 AudioServer: Use strerror correctly in Mixer 2021-11-21 09:27:00 +01:00
Jelle Raaijmakers ddb424a2e7 LibAudio: Verify source and target rates for ResampleHelper 2021-11-21 09:27:00 +01:00
James Mintram bcd518a228 Kernel: Wrap format timespec assignment in a check for !AARCH64
Currently TimeManagement wont compile on AARCH64, so it is not included.
This creates a link error since format.cpp now relies on functionality
in TimeManagement.cpp to add timestamps to log lines.

This PR disables that functionality for AARCH64 builds until
TimeManagement will compile.
2021-11-21 09:12:16 +01:00
Linus Groh f538df7572 CI: Bump prettier to latest version (2.4.1)
We didn't initially upgrade because it started to (incorrectly) see
files as strict mode and chokes on things that then would be syntax
errors - but we're starting to fall behind a bit, so I'd rather put
these files on the ignore list instead.
2021-11-21 01:18:23 +00:00
Ben Wiederhake 66c06e8efb Documentation: Document which file formats exist
I intentionally don't document the format specifics, to prevent this
file from becoming outdated. Hence, only a list with pointers to where
to find details.
2021-11-21 00:31:00 +00:00
Linus Groh 783222f87a LibJS: Implement parsing of TemporalInstantString 2021-11-20 23:10:09 +00:00
Linus Groh 79a18b058f LibJS: Implement parsing of TemporalCalendarString 2021-11-20 23:10:09 +00:00
Linus Groh 1583c7257c LibJS: Implement parsing of TemporalRelativeToString 2021-11-20 23:10:09 +00:00
Linus Groh 98b876ad3f LibJS: Implement parsing of TemporalZonedDateTimeString 2021-11-20 23:10:09 +00:00
Linus Groh 3b1de431cc LibJS: Implement parsing of TemporalYearMonthString 2021-11-20 23:10:09 +00:00
Linus Groh 3ddab2f4fe LibJS: Implement parsing of TemporalMonthDayString 2021-11-20 23:10:09 +00:00
Linus Groh 453c78215c LibJS: Implement parsing of TemporalTimeString 2021-11-20 23:10:09 +00:00
Linus Groh b42b7d5f16 LibJS: Implement parsing of TemporalDateTimeString 2021-11-20 23:10:09 +00:00
Linus Groh 02e7de2cba LibJS: Implement parsing of TemporalDateString 2021-11-20 23:10:09 +00:00
Linus Groh 3f1af7c05f LibJS: Update parse_temporal_time_zone() to match the spec again 2021-11-20 23:10:09 +00:00
Linus Groh 27304017e3 LibJS: Don't assume calendar was parsed in to_temporal_zoned_date_time()
The first step of to_temporal_calendar_with_iso_default() is checking
whether the given value is undefined, so we should actually pass that
instead of unconditionally dereferencing the Optional<String>.
2021-11-20 23:10:09 +00:00
Linus Groh 9628452550 LibJS: Fix fallback of hour, minute, second in parse_iso_date_time()
It's not the `to_uint<u8>()` call that would fail, if we have a value
for these productions they will always be valid numbers. We do need to
provide a fallback for when that's not the case and any of them is
undefined, i.e. an empty Optional.
2021-11-20 23:10:09 +00:00
Linus Groh de23f0b68c LibJS: Start fleshing out an ISO 8601 parser for Temporal
This is the start of a parser for the ISO 8601 grammar used in the
Temporal spec:
https://tc39.es/proposal-temporal/#sec-temporal-iso8601grammar

We will, on purpose, not use a generic ISO 8601 parser from AK or
similar for two reasons:

- Many AOs make specific assumptions about which productions exist and
  access them directly, even when they're part of a larger production.
- The spec says "The grammar deviates from the standard given in ISO
  8601 in the following ways:" and then lists 17 of such deviations.
  Making that work with a general purpose parser is not worth it.

The public API is not being used anywhere yet, but will be in the next
couple of commits. Likewise, the Production enum will be populated with
all the productions accessed directly (e.g. TemporalDateString).

Many thanks to Ali for showing me how to improve my initial approach
full of macros with a nice RAII helper - it's much nicer :^)

Co-Authored-By: Ali Mohammad Pur <mpfard@serenityos.org>
2021-11-20 23:10:09 +00:00
Itamar dd76ba2fe1 CrashReporter: Add "Inspect in Hack Studio" button
This allows the user to open the crash coredump in Hack Studio and
inspect it in the Debug tab.
2021-11-20 21:22:24 +00:00
Itamar 8316eb7306 HackStudio: Add option to inspect Coredump
This adds a --coredump <file> option to Hack Studio.

When used, Hack Studio will open the coredump and allow the user to
inspect it in the Debug tab.
2021-11-20 21:22:24 +00:00
Itamar ce726fe027 HackStudio: Improve backtrace accuracy
We now decrement the return address of the previous frame by one to get
the address of the call instruction and use this address in the
backtrace.

This results in more accurate source position information than what we
previously had when using the return address.
2021-11-20 21:22:24 +00:00
Itamar d6d48ce936 CrashReporter: Unlink coredump file on exit
Previously, when the --unlink flag was passed to CrashReporter, it
unlinked the coredump file immediately after reading it.

This change makes it so the coredump file is deleted when CrashReporter
exits.
2021-11-20 21:22:24 +00:00
Itamar 1c0a7cde63 LibCoredump: Add Coredump::Inspector
The coredump Inspector implements the ProcessInspector interface for
a coredump. It is implemented using Coredump::Reader.
2021-11-20 21:22:24 +00:00
Itamar ac762fbbc3 LibCoredump: Add Reader::for_each_library 2021-11-20 21:22:24 +00:00
Itamar 94d68583fb HackStudio: Use ProcessInspector instead of DebugSession where possible 2021-11-20 21:22:24 +00:00
Itamar 7950f5cb51 LibDebug: Add ProcessInspector base class
ProcessInspector is an abstract base class for an object that can
inspect the address space of a process.

Concrete sub classes need to implement methods for peeking & poking
memory and walking the loaded libraries.

It is currently only implemented by DebugSession.
2021-11-20 21:22:24 +00:00
Itamar 38ddf301f6 Kernel+LibC: Fix ptrace for 64-bit
This makes the types used in the PT_PEEK and PT_POKE actions
suitable for 64-bit platforms as well.
2021-11-20 21:22:24 +00:00
Jelle Raaijmakers 8292061f53 Toolchain: Remove git clone of project from Dockerfile
The goal of these more recent additions to the Dockerfile is to provide
a working copy of SerenityOS with the toolchain prebuilt. To me, these
additions feel misplaced:

- The toolchain is built assuming the i686 architecture, which may not
  be what you want.
- You get a shallow clone of the project limiting you in your abilities
  to navigate through the project's history or bisect.
- There's this awkward directory structure of `/serenity/serenity-git`
  and `/serenity/out`.

The Dockerfile is immensely useful for building SerenityOS in a
containerized environment, separate from the host's environment. If we
want to automate builds, we can always use CI or extend this image to
do so. For now, let's remove the `git clone` and associated actions.

Fixes #9310.
2021-11-20 21:16:51 +00:00
Jelle Raaijmakers cff3add897 Toolchain: Remove unused gettext package from Dockerfile
It is no longer used to build the git port, it seems.
2021-11-20 21:16:51 +00:00
Jelle Raaijmakers b08a265840 Toolchain: Remove unused wget package from Dockerfile 2021-11-20 21:16:51 +00:00
Jelle Raaijmakers 8744086781 Toolchain: Add Qemu build dependencies to Dockerfile
Also add `libsdl2-dev` as a required dependency and reorder the
list of packages passed to `apt-get`.
2021-11-20 21:16:51 +00:00
Jelle Raaijmakers b7bf1a4330 Toolchain: Update Dockerfile to ubuntu:21.10 2021-11-20 21:16:51 +00:00
qiu-x c0a7e0ad23 LibCore: Fix LocalSocket.cpp build on FreeBSD
This fixes the build on FreeBSD by chagning LOCAL_PEERPID to
LOCAL_PEERCRED inside a ifdef
2021-11-20 21:11:30 +00:00
Sam Atkins dc3fa1c2e5 KeyboardSettings: Add icons
A calculator isn't the ideal icon for the Num-lock section, so hopefully
someone will produce a better one later.
2021-11-20 21:05:20 +00:00
Sam Atkins c6099eca5c KeyboardSettings: Add text area to test the currently selected keymap
Right now, this is a bit of a hack. We can't set a keymap to only apply
to the test area, so we set the system keymap instead, while also
keeping track of the "real" current keymap. Whenever the settings are
applied, we update what that "real" keymap is, and when we exit, we
revert to that keymap.

Basically, it behaves as you would expect, apart from it also affecting
other applications you are typing in while the KeyboardSettings window
is open with a different keymap selected.
2021-11-20 21:05:20 +00:00
Sam Atkins 0a2b6b64c6 KeyboardSettings: Migrate to using SettingsWindow :^) 2021-11-20 21:05:20 +00:00
Sam Atkins 4bac30f737 KeyboardSettings: Migrate layout to GML
All other Settings applications use this, so let's match them!
2021-11-20 21:05:20 +00:00
Sam Atkins 1dd5c838cf DisplaySettings: Migrate to using SettingsWindow :^) 2021-11-20 21:05:20 +00:00
Sam Atkins a4af8b2a64 DisplaySettings: Move screen number show/hide logic into widget
This is functionally the same as before, as selecting a tab fires Show
and HideEvents. But this way, we don't need to directly access the
TabWidget, which will make using SettingsWindow simpler.
2021-11-20 21:05:20 +00:00
Sam Atkins 9fc53017c6 MouseSettings: Adjust layout so mouse-button image is no longer clipped 2021-11-20 21:05:20 +00:00