Commit graph

14473 commits

Author SHA1 Message Date
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
Tom
1f86d88dc4 Kernel: Don't assert if we can't deliver a signal due to thread state
Fixes an assertion found in #3990
2020-12-01 16:09:15 +01:00
Andreas Kling
6ec9901d1b LibELF: Fix busted validation of section header location 2020-12-01 13:18:32 +01:00
Ben Wiederhake
e85aad6acc Meta: Always check completeness of ALL_THE_DEBUG_MACROS 2020-12-01 11:06:53 +01:00
Ben Wiederhake
e1baf9ec92 Meta: Refresh ALL_THE_DEBUG_MACROS set 2020-12-01 11:06:53 +01:00
Ben Wiederhake
f82b2948cf Meta: Fix BMP_DEBUG, and always build on CI 2020-12-01 11:06:53 +01:00
Ben Wiederhake
2b3113cd2a Meta: Fix ACPI_DEBUG, and always build on CI 2020-12-01 11:06:53 +01:00
Ben Wiederhake
59091e1861 Meta: Nicer wording in lint 2020-12-01 11:06:53 +01:00
Ben Wiederhake
a0f6db246e Meta: Document fuzz dump 2020-12-01 11:06:23 +01:00
Zac
99e301510e FileManager: Call on_selection_change with the correct view 2020-12-01 11:05:08 +01:00
Andrew Kaster
3f808b0dda LibELF+Kernel: Validate program headers in Image::parse
This should catch more malformed ELF files earlier than simply
checking the ELF header alone. Also change the API of
validate_program_headers to take the interpreter_path by pointer. This
makes it less awkward to call when we don't care about the interpreter,
and just want the validation.
2020-12-01 09:58:21 +01:00
Andrew Kaster
8297698a3a LibELF: Catch more Shenanigans in ELF files
Check for even more weird program header/section header offsets
and sizes. Namely, the ones encountered in #4221 :)
2020-12-01 09:58:21 +01:00
Linus Groh
48c19cdb06 LibJS: Remove ProxyPrototype
Proxy is an "exotic object" and doesn't have its own prototype. Use the
regular object prototype instead, but most stuff is happening on the
target object anyway. :^)
2020-12-01 09:54:37 +01:00
Tom
78f1b5e359 Kernel: Fix some problems with Thread::wait_on and Lock
This changes the Thread::wait_on function to not enable interrupts
upon leaving, which caused some problems with page fault handlers
and in other situations. It may now be called from critical
sections, with interrupts enabled or disabled, and returns to the
same state.

This also requires some fixes to Lock. To aid debugging, a new
define LOCK_DEBUG is added that enables checking for Lock leaks
upon finalization of a Thread.
2020-12-01 09:48:34 +01:00
Tom
9e32d79e02 Kernel: Fix leaking a reference on thread creation
New Thread objects should be adopted into a RefPtr upon creation.
If creating a thread failed (e.g. out of memory), releasing the RefPtr
will destruct the partially created object, but in the successful case
the thread will add an additional reference that it keeps until it
finishes execution. Adopting will drop it to 1 when returning from
create_thread, or 0 if the thread could not be fully constructed.
2020-12-01 09:26:37 +01:00
AnotherTest
602a830428 Spreadsheet: Invert the drag-selection trigger
Make drag-selection the default behaviour, allowing (almost) any part of
the cell to initiate a select.
a small 5x5 rect at the corners of a cell can be used to initiate a
drag-copy instead.
Fixes #4268.
2020-11-30 17:54:54 +01:00
AnotherTest
50b7122798 Shell: Error out when an expression is nested too deep
That can happen with too many nested parenthesis, for instance.
This commit sets the maximum allowed limit to 2048 (seems relatively
safe for normal code).
Found by oss-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28105&q=label%3AProj-serenity
2020-11-30 17:45:15 +01:00
AnotherTest
6394720c87 LibRegex: Don't try to consume the escaped character if at EOF
Fixes assert on e.g. `new RegExp("\\")`
2020-11-30 17:45:05 +01:00
Tom
3bda458735 Kernel: Lock should keep a reference to whoever holds the lock
Fixes a crash reported in #3990
2020-11-30 13:17:02 +01:00
Tom
046d6855f5 Kernel: Move block condition evaluation out of the Scheduler
This makes the Scheduler a lot leaner by not having to evaluate
block conditions every time it is invoked. Instead evaluate them as
the states change, and unblock threads at that point.

This also implements some more waitid/waitpid/wait features and
behavior. For example, WUNTRACED and WNOWAIT are now supported. And
wait will now not return EINTR when SIGCHLD is delivered at the
same time.
2020-11-30 13:17:02 +01:00
Tom
6a620562cc Kernel: Allow passing a thread argument for new kernel threads
This adds the ability to pass a pointer to kernel thread/process.
Also add the ability to use a closure as thread function, which
allows passing information to a kernel thread more easily.
2020-11-30 13:17:02 +01:00
Tom
6cb640eeba Kernel: Move some time related code from Scheduler into TimeManagement
Use the TimerQueue to expire blocking operations, which is one less thing
the Scheduler needs to check on every iteration.

Also, add a BlockTimeout class that will automatically handle relative or
absolute timeouts as well as overriding timeouts (e.g. socket timeouts)
more consistently.

Also, rework the TimerQueue class to be able to fire events from
any processor, which requires Timer to be RefCounted. Also allow
creating id-less timers for use by blocking operations.
2020-11-30 13:17:02 +01:00
Tom
e0e26c6c67 LibCore: Don't wait for negative amount of time 2020-11-30 13:17:02 +01:00
AnotherTest
c1276559ba Spreadsheet: Implement drag-to-select
To initiate drag-to-select, the user can move the mouse to near the edge
of a cell, and click-and-drag when the cursor changes to a crosshair.
Fixes #4167.
2020-11-30 12:07:45 +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
AnotherTest
169beff21e LibGUI: Add a ModelSelection::add_all(Vector) API
Using add() is very slow due to the change notifications.
2020-11-30 12:07:45 +01:00
AnotherTest
b532b2d3ca Spreadsheet: Clear callbacks on persistent widgets before tearing tabs down
Otherwise changes to the widgets would cause all sorts of updates on
half-deleted cells.
Fixes #4171.
2020-11-30 12:07:45 +01:00
AnotherTest
a20f1202a8 Spreadsheet: Clear the cell and commit when the delete key is pressed
...as the initial stroke that begins an edit.
This is still imperfect, as it completely ignores selections.
Fixes #4168 (sort of).
2020-11-30 12:07:45 +01:00
AnotherTest
b66f3166cb LibGUI: Throw less view state away in model_did_update()
When `DontInvalidIndexes` is passed, be optimistic and keep the old
indices when the model validates them.
This is currently fine, as the group of models that use
DontInvalidateIndexes use it as "The old indices are still ok" (there's
a note about this in ProcessModel.cpp).
2020-11-30 12:07:45 +01:00
AnotherTest
c84756efa8 LibGUI: Don't start editing with (just) modifier keys when AnyKeyPressed
This fixes the control key starting an edit on (and inserting a nul
character into) a cell in Spreadsheet.
2020-11-30 12:07:45 +01:00
AnotherTest
474453244b Spreadsheet: Implement infinit-scroll for columns
This naturally also implements multi-char columns, and also integrates
it into the js runtime (such columns can be named in ranges too).
2020-11-30 12:07:45 +01:00
AnotherTest
f6ae4edbd2 Spreadsheet: Implement infinite-scroll for rows
Every time the scrollbar reaches the end, we append 100 more rows
(seamlessly!).
As a result of defaulting to 100 rows, we can also save with the
smallest number of rows required.
This partially deals with #4170.
2020-11-30 12:07:45 +01:00
AnotherTest
71de8b7480 LibGUI: Remove `AbstractView::did_update_model()'
...and use `ModelClient::model_did_update()' instead.
This makes AbstractView a ModelClient (which it always was anyway).
2020-11-30 12:07:45 +01:00
AnotherTest
868c315e51 Spreadsheet: Force-update the spreadsheet widget after pasting
Just updating the sheet will not cause a widget update.
2020-11-30 12:07:45 +01:00
Andreas Kling
113da74683 LibWeb: Deallocate DOM timer ID's when the timer goes away
I left a page open overnight and it had run out of timer ID's. :^)
2020-11-30 11:40:35 +01:00
devashish
8b194f41e9 JPGLoader: Remove JPEG fuzz files from the main repository
...and transfer them to SerenityOS/serenity-fuzz-corpora.
2020-11-30 11:38:59 +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
AnotherTest
8cada744df LibRegex: Give the bytecode a chance to run when there's no input
Fixes #4246
Also adds a test case.
2020-11-30 11:37:30 +01:00
AnotherTest
ab2c646d5d LibRegex: Fix OOB access in Regex debug print 2020-11-30 11:37:30 +01:00
Linus Groh
ea08bf5812 LibJS: Fix crash in Lexer on EOF in unterminated template literal
Fixes #4252.
2020-11-30 11:36:42 +01:00
Linus Groh
8284f87867 LibRegex: Add bounds check to Lexer::back()
If the offset is zero and we're already at the end of the lexer's input
an out of bounds read (m_source[m_position]) would occur.
Also check that the offset is not more than m_position (which should
never be the case, and would result in m_position underflowing).

Fixes #4253.
2020-11-30 11:36:24 +01:00
Luke
7094697743 LibMarkdown: Reduce debug spam from invalid characters in table headings
Happens a lot when fuzzing.
2020-11-30 11:35:45 +01:00
Luke
030dac8c4d Lagom/Fuzzers: Add URL fuzzer 2020-11-30 11:35:16 +01:00
Linus Groh
ba020a5907 AK: Fix logic error in urldecode() percent-decoding
We also need to append the raw consumed value if *either* of the two
characters after the % isn't a hex digit, not only if *both* aren't.

Fixes #4257.
2020-11-30 11:35:01 +01:00
Tom
4c8c149612 Terminal: Wait on the utmpupdate process to finish
This solves utmpupdate zombies hanging around until Terminal
terminates.
2020-11-30 11:34:08 +01:00
Andreas Kling
65eef944ab LibWeb: Auto-size table box height to fit all the rows
This is just a hack until we implement the full 'height' property for
tables. :^)
2020-11-29 22:39:01 +01:00
Andreas Kling
b19f62217f LibWeb: Allow inline-block boxes to have non-inline children
We were incorrectly hoisting non-inline children of inline-block boxes
to the nearest non-inline ancestor.

Since inline-block boxes are only inline on the *outside*, it's fine
for them to have non-inline children.

Eventually we should clarify these relationships by making the inside
and outside display types more explicit.
2020-11-29 22:26:54 +01:00
Andreas Kling
13c32e0607 LibCore: Reduce debug spam from successful gzip decoding 2020-11-29 22:20:27 +01:00
Andreas Kling
39c7d9f061 LibWeb: Remove margin/border/padding from inline-block available width 2020-11-29 22:00:44 +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