Commit graph

55298 commits

Author SHA1 Message Date
Tim Ledbetter dd81bea9ef LibGfx: Don't read past EOF in JPEGLoader
Previously, it was possible to pass JPEGLoader a crafted input which
would read past the end of the stream. We now return an error in such
cases.
2023-10-02 20:09:25 +02:00
Kemal Zebari 001abbcd66 AK: Rename URLParser:parse_host() param is_not_special to is_opaque
Since the spec renamed it to make it easier to read.
2023-10-01 14:35:40 +02:00
Tim Ledbetter c087ba24b9 Assistant: Avoid an unnecessary copy of the results list 2023-10-01 14:34:28 +02:00
Tim Ledbetter 55f4d468ad Assistant: Remember currently selected result when updating results
This fixes an issue where the selected result index would be reset to
0 when the file cache finished building and the results list updated.
2023-10-01 14:34:28 +02:00
Tim Ledbetter 3ee12ffa8f stat: Show the device ID for the given file 2023-10-01 13:34:41 +02:00
Tim Ledbetter ad984ba522 Kernel: Populate stat.st_dev with fsid
This allows userland programs to differentiate inodes on different
filesystems.
2023-10-01 13:34:41 +02:00
kleines Filmröllchen 4cefb02324 AK: Use secure SipHash-4-8 for IP addresses
Routing tables formed with IP address hashes should be DoS-resistant.
2023-10-01 11:06:36 +03:30
kleines Filmröllchen 9a026fc8d5 AK: Implement SipHash as the default hash algorithm for most use cases
SipHash is highly HashDoS-resistent, initialized with a random seed at
startup (i.e. non-deterministic) and usable for security-critical use
cases with large enough parameters. We just use it because it's
reasonably secure with parameters 1-3 while having excellent properties
and not being significantly slower than before.
2023-10-01 11:06:36 +03:30
Nico Weber 5e15c29e22 MacPDF: Use "MacPDF" in MainMenu.xib
I forgot to rename it there, whoops.
2023-09-30 19:37:39 -06:00
Nico Weber 76f0a09b5e MacPDF: Rename LagomPDFDocument to MacPDFDocument 2023-09-30 19:37:26 -06:00
Nico Weber f99771d46f MacPDF: Rename LagomPDFView to MacPDFView 2023-09-30 19:37:26 -06:00
kleines Filmröllchen 3296fb0189 Base: Add an ISO C++-compliant quote to the fortunes database
CC @alimpfard
2023-09-30 20:28:27 +02:00
Timon Kruiper d170186163 Kernel/aarch64: Subtract KERNEL_MAPPING_BASE from driver_init section
This subtraction is necessary to ensure that the section has the correct
address. Also, without this change, the Kernel ELF binary would explode
in size. This was forgotten in a0dd6ec6b1.
2023-09-30 16:58:15 +02:00
kleines Filmröllchen 614ff9c46e Maps: Load tiles starting from center
The information the user is most interested in is usually in the center,
so we should start loading tiles from the center and move outwards.
Since tiles are loaded in draw order, simply drawing them in this order
achieves the desired effect. The current center-outwards loading
algorithm is a basic spiral algorithm, but others may be evaluated
later.
2023-09-30 11:11:05 +02:00
Andreas Kling a54e283901 LibJS: Fix two bugs in the GC fast rejection of possible pointers
- Convert to FlatPtr instead of doing pointer arithmetic on a too-large
  pointer type in find_min_and_max_block_addresses(). This makes the
  range more accurate.

- Untag possible cell pointers in add_possible_value() before doing the
  rejection. Otherwise we end up rejecting most pointers since the tags
  sit in the highest bits!

This fixes a crash when running the Speedometer benchmark.
2023-09-30 09:50:55 +02:00
Andreas Kling f388d2362a LibJS: Pad the capacity of BasicBlock while growing it
Just using Vector::resize() meant that we allocated exact capacity
instead of leaving padding at the end. This patch adds a call to
grow_capacity() before resize(), which ensures that we grow with the
usual extra padding.
2023-09-30 09:33:11 +02:00
Nico Weber a0b939cef4 MacPDF: Show correct page number in title bar after restore 2023-09-30 08:08:11 +02:00
Nico Weber e5283cd648 MacPDF: Define AK_DONT_REPLACE_STD
The bots complain that `forward()` could be either from libc++'s
include/c++/v1/__utility/forward.h or from AK/StdLibExtras.h.

I don't see this locally, but Ladybird also defined AK_DONT_REPLACE_STD,
so let's see if this does the trick.
2023-09-30 08:08:11 +02:00
Nico Weber e4d2aa82e2 MacPDF: Don't hardcode my serenity directory
https://www.africau.edu/images/default/sample.pdf is a good
document for testing that the built-in fonts load.
2023-09-30 08:08:11 +02:00
Nico Weber 8a7d3cb3f4 MacPDF: Override -[NSDocument isEntireFileLoaded]
We keep the NSData object around and stream for it, so that looks
like a good thing to do.
2023-09-30 08:08:11 +02:00
Nico Weber e9b0ebe55a MacPDF: Use Serenity license headers, remove Xcode boilerplate 2023-09-30 08:08:11 +02:00
Nico Weber 91e0438fca MacPDF: Make buildable from CMake
Use `Meta/serenity.sh build lagom MacPDF` to build, and either of
`open Build/lagom/bin/MacPDF.app` or
`Build/lagom/bin/MacPDF.app/Contents/MacOS/MacPDF` to run.

Xcode used to insert a bunch of things to Info.plist. Now it can
no longer do that, so manually put them there
2023-09-30 08:08:11 +02:00
Nico Weber 0216f34179 MacPDF: Move some files around
1. main.m is now main.mm
2. MainMenu.xib is now no longer in a Base.lproj subfolder
3. Remove SerenityPDF.entitlements since it won't be used in our CMake
   build
2023-09-30 08:08:11 +02:00
Nico Weber 5af30b8f63 MacPDF: Tweak "#pragma mark" comments 2023-09-30 08:08:11 +02:00
Nico Weber d2bda064da MacPDF: Pre-populate "Go to Page..." dialog with current page 2023-09-30 08:08:11 +02:00
Nico Weber e67d8cfb2a MacPDF: Show current page and page count in subtitle 2023-09-30 08:08:11 +02:00
Nico Weber bd19fcc039 MacPDF: Add a "Go to Page..." menu item
xib changes:
* Add a "Go" toplevel submenu
* Put a "Go to Page..." menu item in it
* Add showGoToPageDialog: to first responder
* Bind action of new menu item to that

The dialog is just a janky NSAlert for now.
2023-09-30 08:08:11 +02:00
Nico Weber fe4fe5ceff MacPDF: Support opening password-protected PDFs
This is a bit janky for several reasons:
* `initialize` is now no longer called on a bg thread
* sheet UI is janky both visually and from an implementation PoV

But hey, it works for now.
2023-09-30 08:08:11 +02:00
Nico Weber 97dbdbc9b0 MacPDF: Fill bitmap cache on demand in -[LagomPDFView drawRect]
Removes one needless paint on document restore, and makes sure
that window resizing invalidates the cache (since this now checks
the bitmap's size).
2023-09-30 08:08:11 +02:00
Nico Weber 2799dedb1b MacPDF: Save and restore current page
This works great when quitting and reopening the app,
but when closing a window and the reopening from Recent Files,
the current page isn't restored. In Preview.app, it is.
2023-09-30 08:08:11 +02:00
Nico Weber 5401f3aecc MacPDF: Clean up some includes 2023-09-30 08:08:11 +02:00
Nico Weber f5e81c8a99 MacPDF: Make pdfs without embedded fonts work again
A prior change removed some (very hacky) code needed for this
2023-09-30 08:08:11 +02:00
Nico Weber 87f31cab70 MacPDF: Remove application restore logging again 2023-09-30 08:08:11 +02:00
Nico Weber d3e8d87672 MacPDF: Add some temporary logging for application restoring
In the end, apparently I had "Close windows when quitting an
application" enabled in Desktop & Dock in System Settings. With that
turned off, it just worked (...but I still need to serialize the current
page in the view).

Even with it turned off, cmd-opt-q would "Quit and Keep Windows",
so I could've also used that for testing.
2023-09-30 08:08:11 +02:00
Nico Weber 751ed5e1ee MacPDF: Larger default window size 2023-09-30 08:08:11 +02:00
Nico Weber 43859f07ec MacPDF: Opt in to both automatic and sudden termination
Automatic termination means that the app no longer shows up as
opened in the doc when the last Window is closed, but it's actually
still running and opens immediately when clicked again.

Sudden termination means that the app can close quickly on logout.
I think it means the runtime just calls _exit() and assumes all
data is saved continuously.
2023-09-30 08:08:11 +02:00
Nico Weber 819a602ee1 MacPDF: Actually show contents of opened PDFs
xib change: connected _pdfView outlet to LagomPDFView instance.
2023-09-30 08:08:11 +02:00
Nico Weber 0a01a2c82b MacPDF: Start converting to document architecture
Cmd-O now produces an Open... dialog, and opening a PDF file reads it
(and then creates the old LagomPDFView object, which then reads
a hardcoded PDF again and displays that. One thing at a time.)

"Open Recent>" is also populated and seems to work.

See the guide:
https://developer.apple.com/library/archive/documentation/DataManagement/Conceptual/DocBasedAppProgrammingGuideForOSX/Introduction/Introduction.html
2023-09-30 08:08:11 +02:00
Nico Weber 77b311f00a MacPDF: FixedPoint hack fix courtesy of trflynn
Also some minor cleanups, and pick a different default document.
2023-09-30 08:08:11 +02:00
Nico Weber ef91ced481 MacPDF: Change current page with arrow left/right 2023-09-30 08:08:11 +02:00
Nico Weber c4c4ead9d2 MacPDF: Highdpi! 2023-09-30 08:08:11 +02:00
Nico Weber 6e0dea3a12 MacPDF: Style tweaks; one less leak 2023-09-30 08:08:11 +02:00
Nico Weber 4d9233dacc MacPDF: Fewer leaks; cache bitmap; refactor a bit 2023-09-30 08:08:11 +02:00
Nico Weber 2831654b00 MacPDF: Initial commit
This is mostly the output of the Xcode new app wizard.
2023-09-30 08:08:11 +02:00
Aliaksandr Kalenik e79d4f3462 LibJS: Early reject pointers outside of allocated blocks range in GC
This change adds a check to discard pointers that are lower than the
minimum address of all allocated blocks or higher than the maximum
address of all blocks. By doing this we avoid executing plenty of set()
operations on the HashMap in the add_possible_value().

With this change gather_conservative_roots() run 10x times faster in
Speedometer React-Redux-TodoMVC test.
2023-09-30 08:07:12 +02:00
Hendiadyoin1 29292bbdbf Kernel/USB: Add a crude USB MassStorage driver :^) 2023-09-29 16:14:47 -06:00
Hendiadyoin1 c230a0d96f Kernel: Avoid some copies during USBInterface enumeration/creation 2023-09-29 16:14:47 -06:00
Hendiadyoin1 b857c6b92f Kernel/USB: Make USBControllers pseudo StorageControllers
This will be needed in the next commit to generate valid LUNs
2023-09-29 16:14:47 -06:00
Hendiadyoin1 4b327bdc95 Kernel/USB: Add UKBuffer variants of certain BulkPipe/Transfer functions
These will be useful for directly accessing the source/destination
buffers, without going through a third buffer first.
2023-09-29 16:14:47 -06:00
Hendiadyoin1 8335803045 Kernel/USB: Explicitely copy descriptor.hub_characteristics for printing
This field is in a packed struct, which makes it possibly misaligned.
This knowledge is lost when invoking `dbgln` triggering an unaligned
access to it, aka UB. By explicitely copying it we avoid this issue.
2023-09-29 16:14:47 -06:00