Ben Wiederhake
453c63fd04
LibGfx+BMP: Remove set_remaining, fix size check
...
The set_remaining method is inherently dangerous. It can be avoided easily here,
so let's do that.
2020-12-02 10:46:40 +01:00
Ben Wiederhake
36daeee34f
LibGfx: Fix BMP mask detection off-by-one
...
Also, since the loops can be replaced by a little bit-twiddling,
call ctz() directly. This might be a bit faster, or it might not.
2020-12-02 10:46:40 +01:00
Ben Wiederhake
6be9b6349d
LibGfx: Prevent potential heap-overflow in BMP non-RLE
2020-12-02 10:46:40 +01:00
Ben Wiederhake
461bdeda2b
LibGfx: Fix heap-overflow in BMP RLE
...
The field previously named 'data_size' apparently was misunderstood.
2020-12-02 10:46:40 +01:00
Ben Wiederhake
d66b0683eb
LibGfx: Distinguish between RGB data and file data
...
This was confusing and has hidden a bug, so let's change it.
2020-12-02 10:46:40 +01:00
Ben Wiederhake
9ff001c4d3
LibGfx: Avoid ByteBuffer assertions for huge bitmaps
2020-12-02 10:46:40 +01:00
Ben Wiederhake
d6c0776b45
LibGfx: Reject OS/2 BMP files with invalid bpp values
2020-12-02 10:46:40 +01:00
Ben Wiederhake
bd6d365166
LibGfx: Disallow RLE8 compression for 16bpp BMPs
...
Also, disallow similar silly combinations. Technically, we support *more* than
the definition seems to require.
For future reference:
https://archive.org/details/mac_Graphics_File_Formats_Second_Edition_1996/page/n607/mode/2up
Book page 580 (pdf page 608)
2020-12-02 10:46:40 +01:00
Ben Wiederhake
e3e2eecc33
LibGfx: Fix BMP compression checks
...
- OSv2 DIBs were not checked at all
- Regular Info DIBs had the compression checked after applying a 0xFF mask,
which let many invalid compression values pass.
- There may still be a separate latent bug that causes mask_sizes and mask_shifts to be empty.
2020-12-02 10:46:40 +01:00
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
xspager
57c9f77921
LibC: Add flag SO_BROADCAST so we can at least build programs that use it
2020-12-02 10:45:38 +01:00
AnotherTest
d1a5b4d906
LibWeb: Complete the URL in href_setter() before trying to load it
...
Also note that setting an invalid URL here should raise a JS exception
(and not navigate away).
Fixes #4301 .
2020-12-02 10:08:29 +01:00
Andreas Kling
3565d3c60c
LibJS: Add six typed arrays (signed and unsigned 8/16/32-bit)
...
This patch adds six of the standard type arrays and tries to share as
much code as possible:
- Uint8Array
- Uint16Array
- Uint32Array
- Int8Array
- Int16Array
- Int32Array
2020-12-01 21:05:25 +01:00
Andreas Kling
93feb7a81f
LibJS: Have Uint8ClampedArray delegate OOB accesses to JS::Object
...
Uint8ClampedArray itself only cares about legitimate in-bounds accesses
since that's what where the specialization happens.
2020-12-01 17:12:04 +01:00
Andreas Kling
f2c7caf2db
LibJS: Zero out memory in newly allocated Uint8ClampedArray objects
2020-12-01 17:06:48 +01:00
Andreas Kling
7c4c706ebe
LibWeb: Implement Document.getElementsByClassName()
...
Note that we're taking a shortcut here and returning the elements as an
Array instead of HTMLCollection. One day we'll have to bite the bullet
and deal with HTMLCollection, but not today.
2020-12-01 16:53:10 +01:00
Andreas Kling
09da5f7263
LibWeb: Hack the CSS parser to skip over UTF-8 BOM
...
This is a rather ugly hack that fixes CSS parsing on websites where we
get a stylesheet that starts with a BOM.
2020-12-01 16:53:10 +01:00
Andreas Kling
bbcc71fec4
LibWeb: Parse :before and :after pseudo-elements
...
Note that this is the old CSS2 syntax, we don't support the CSS3 syntax
just yet. Also we don't actually implement the pseudo-elements, this is
really just to make the selectors distinct from the same ones without
these pseudo-elements.
2020-12-01 16:53:10 +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
Andreas Kling
6ec9901d1b
LibELF: Fix busted validation of section header location
2020-12-01 13:18:32 +01:00
Ben Wiederhake
f82b2948cf
Meta: Fix BMP_DEBUG, and always build on CI
2020-12-01 11:06:53 +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
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
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
e0e26c6c67
LibCore: Don't wait for negative amount of time
2020-11-30 13:17:02 +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
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
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
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
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
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
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
Andreas Kling
d0636291fe
LibWeb: Resolve percentage width/height of inline-block boxes
...
Percentage lengths cannot be to_px()'ed directly, we have to resolve
them against a reference (the containing block) first.
Fixes #4248 .
2020-11-29 21:27:41 +01:00
Linus Groh
eea7cabdbc
LibRegex: Use match_ordinary_characters() in ECMA262Parser::parse_atom()
...
Otherwise we would only match TokenType::Char, making all of these invalid:
- /foo,bar/
- /foo\/bar/
- /foo=bar/
- /foo-bar/
- /foo:bar/
Fixes #4243 .
2020-11-29 20:35:52 +01:00
AnotherTest
5c8b48053e
LibVT: Make terminal scrollback max size configurable
2020-11-29 20:32:45 +01:00