Truly independent web browser
Go to file
Nico Weber 87112dcbdc LibPDF: Return null for invalid refs, tolerate null objects as outline
https://llvm.org/devmtg/2022-11/slides/TechTalk5-WhatDoesItTakeToRunLLVMBuildbots.pdf
has an xref table that starts like so:

```
xref
0 214
0000000002 65535 f
0000924663 00000 n
0000000003 00000 f
0000000000 00000 f
0000000016 00000 n
0000000160 00000 n
0000000263 00000 n
```

This is a list of objects in the PDF file. The lines ending with 'f'
mean that this object is "free", that is it's not stored in the file.
In this file, objects 0, 2, 3 are free. For free objects, the first
number is the offset of the next free object: Object 0 refers to object
2, 2 to 3, and 3 back to 0 (since it's the last free object).
The lines ending with "n" are actual objects; here the first number is
a byte offset to where that object is stored in the file.

Furthermore, the file contains

```
/Outlines
2
0
R
```

in its root object, meaning that object 2 stores the page outlines.

Since object 2 is set as free, there is no object 2. But the spec
says that an invalid object reference is just the null object.

This patch makes us return null objects for references to free
objects, and it also makes us treat a null object as /Outlines value
the same as not having /Outlines in the first place.

Fixes #23023 -- we can now open that file. (We don't render it super
well, but only for already-known reasons.)

Since I found it a bit confusing: XRefTable has two related methods
here:

1. has_object() returns if an object was explicitly listed in an
   xref table. The first number right after `xref` is the start
   index. So if an xref table were to start with `10`, we'd implicitly
   create 10 trailing objects for which has_object() would return false
2. is_object_in_use() returns true if an object that was in a table
   (i.e. one where has_object() returns true) was listed with 'n' and
   false if it was listed with 'f'.

DocumentParser::parse_object_with_index() should probably return a null
object for the `!has_object()` case as well instead of VERIFY()ing
that has_object() is true. But I haven't seen this in the wild yet,
so keeping as-is for now.
2024-01-31 12:10:19 -05:00
.devcontainer Meta: Switch to clang-format-16 as the standard formatter 2023-07-08 10:32:56 +01:00
.github CI: Bump actions/cache from 3 to 4 2024-01-22 09:02:37 -05:00
AK AK: Remove the SIMD version of rsqrt() too, for good measure 2024-01-30 10:02:33 +01:00
Base Everywhere: Remove references to UserspaceEmulator 2024-01-29 20:20:55 +00:00
Documentation Documentation: Add guidelines for writing manual pages 2024-01-29 05:30:30 -07:00
Kernel Kernel/riscv64: Implement everything in PageDirectory.cpp 2024-01-29 05:17:03 -07:00
Ladybird Ladybird+LibWeb+WebContent: Port the did_request_cookie IPC to String 2024-01-26 20:22:39 +01:00
Meta pdf+MacPDF: Use new Build/Root/lagom/res directory 2024-01-30 18:43:06 -07:00
Ports Ports: Update zlib to 1.3.1 2024-01-23 18:31:00 +01:00
Tests LibWeb: Account for scroll offset in overflow clip rect calculation 2024-01-31 07:15:25 +01:00
Toolchain Kernel: Add initial basic support for KASAN 2023-12-30 13:57:10 +01:00
Userland LibPDF: Return null for invalid refs, tolerate null objects as outline 2024-01-31 12:10:19 -05:00
.clang-format Meta: Support using clang-format on Objective-C++ files 2023-08-22 21:36:19 -04:00
.clang-tidy Meta: Disable misc-use-anonymous-namespace clang-tidy warning 2023-08-23 12:25:40 +01:00
.editorconfig Meta: Add .editorconfig 2022-09-10 17:32:55 +01:00
.gitattributes Repository: Protect port patches from CRLF/LF normalization 2022-01-12 01:08:38 +01:00
.gitignore Meta: Move .DS_Store rule to the bottom of the .gitignore file 2023-11-14 14:53:37 -05:00
.gn Meta: Automatically generate a compilation database for clangd 2023-11-14 14:29:35 -05:00
.mailmap Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2023-07-15 16:21:29 +02:00
.pre-commit-config.yaml Meta: Add a post-commit commit message linter hook 2021-05-02 16:28:01 +02:00
.prettierignore LibJS: Add DisposableStack{, Prototype, Constructor} 2023-01-23 09:56:50 +00:00
.prettierrc Meta: Move prettier config files to the root of the repository 2020-08-24 18:21:33 +02:00
.ycm_extra_conf.py Meta: Remove i686 references in YCM configuration 2022-12-28 11:53:41 +01:00
azure-pipelines.yml CI: Remove extraneous toolchain job from Azure CI 2022-12-28 15:26:12 -05:00
CMakeLists.txt Meta: Replace run.sh by run.py 2023-12-15 00:11:50 +01:00
CONTRIBUTING.md Meta: Add a note about resolving PR review comments 2023-10-18 13:32:13 +02:00
LICENSE Meta: Update the year range in LICENSE 2024-01-06 17:39:16 -05:00
README.md Everywhere: Remove references to UserspaceEmulator 2024-01-29 20:20:55 +00:00
SECURITY.md Meta: Add a security policy 2022-06-29 03:29:27 +00:00

SerenityOS

Graphical Unix-like operating system for x86-64 computers.

GitHub Actions Status Azure DevOps Status Fuzzing Status Sonar Cube Static Analysis Discord

FAQ | Documentation | Build Instructions

About

SerenityOS is a love letter to '90s user interfaces with a custom Unix-like core. It flatters with sincerity by stealing beautiful ideas from various other systems.

Roughly speaking, the goal is a marriage between the aesthetic of late-1990s productivity software and the power-user accessibility of late-2000s *nix. This is a system by us, for us, based on the things we like.

You can watch videos of the system being developed on YouTube:

Screenshot

Screenshot as of c03b788.png

Features

  • Modern x86 64-bit kernel with pre-emptive multi-threading
  • Browser with JavaScript, WebAssembly, and more (check the spec compliance for JS, CSS, and Wasm)
  • Security features (hardware protections, limited userland capabilities, W^X memory, pledge & unveil, (K)ASLR, OOM-resistance, web-content isolation, state-of-the-art TLS algorithms, ...)
  • System services (WindowServer, LoginServer, AudioServer, WebServer, RequestServer, CrashServer, ...) and modern IPC
  • Good POSIX compatibility (LibC, Shell, syscalls, signals, pseudoterminals, filesystem notifications, standard Unix utilities, ...)
  • POSIX-like virtual file systems (/proc, /dev, /sys, /tmp, ...) and ext2 file system
  • Network stack and applications with support for IPv4, TCP, UDP; DNS, HTTP, Gemini, IMAP, NTP
  • Profiling, debugging and other development tools (Kernel-supported profiling, CrashReporter, interactive GUI playground, HexEditor, HackStudio IDE for C++ and more)
  • Libraries for everything from cryptography to OpenGL, audio, JavaScript, GUI, playing chess, ...
  • Support for many common and uncommon file formats (PNG, JPEG, GIF, MP3, WAV, FLAC, ZIP, TAR, PDF, QOI, Gemini, ...)
  • Unified style and design philosophy, flexible theming system, custom (bitmap and vector) fonts
  • Games (Solitaire, Minesweeper, 2048, chess, Conway's Game of Life, ...) and demos (CatDog, Starfield, Eyes, mandelbrot set, WidgetGallery, ...)
  • Every-day GUI programs and utilities (Spreadsheet with JavaScript, TextEditor, Terminal, PixelPaint, various multimedia viewers and players, Mail, Assistant, Calculator, ...)

... and all of the above are right in this repository, no extra dependencies, built from-scratch by us :^)

Additionally, there are over three hundred ports of popular open-source software, including games, compilers, Unix tools, multimedia apps and more.

How do I read the documentation?

Man pages are available online at man.serenityos.org. These pages are generated from the Markdown source files in Base/usr/share/man and updated automatically.

When running SerenityOS you can use man for the terminal interface, or help for the GUI.

Code-related documentation can be found in the documentation folder.

How do I build and run this?

See the SerenityOS build instructions. Serenity runs on Linux, macOS (aarch64 might be a challenge), Windows (with WSL2) and many other *Nixes with hardware or software virtualization.

Get in touch and participate!

Join our Discord server: SerenityOS Discord

Before opening an issue, please see the issue policy.

A general guide for contributing can be found in CONTRIBUTING.md.

Authors

And many more! See here for a full contributor list. The people listed above have landed more than 100 commits in the project. :^)

License

SerenityOS is licensed under a 2-clause BSD license.