ladybird/Userland/Libraries
Nico Weber 11bee7a075 LibPDF: Don't crash on fixed-width type 1 fonts that use /MissingWidth
Type 1 fonts usually have a m_font_program and no m_font -- they only
have m_font if we're using a replacement font for the fonts that
were built-in to PDFs before Acrobat 4.0 (and must still work to
show existing files).

However, SimpleFont::get_glyph_width() used to always return a
float, which in Type1Font was only implemented if m_font was set.

Per spec, we're supposed to just use /MissingWidth for fonts that
are missing an entry in the descriptor's /Width array. However, for
built-in fonts, no explicit /Width array is needed (PDF 1.7 spec,
Appendix H.3, 5.5.1). So if we just always use /MissingWidth,
then PDFs that use a built-in font draw all their text on top
of each other (e.g. 000333.pdf from stillhq.com-pdfdb).

So change get_glyph_width() to return Optional<float>, return
it only in Type1Font if m_font is set, and use MissingWidth
if it isn't set.

That way, replacement fonts still return a width, and real
fonts that are supposed to have /Width and use /MissingWidth
for missing entries do what they're supposed to too, instead
of crashing.

From 20 (6%) to 16 (5%) crashes on the 300 first PDFs, and from
39 (7.8%) to 31 (6.2%) on the 500-random PDFs test.
2023-10-23 09:33:03 -04:00
..
LibArchive LibArchive: Ensure tar extended header length is within expected range 2023-10-03 15:39:20 +02:00
LibAudio LibAudio: Use mapped files for audio playback 2023-09-27 03:22:56 +02:00
LibC AK: Remove rarely used ExtraMathConstants.h 2023-10-23 12:04:51 +01:00
LibCards GamesSettings+LibCards: Make 'Red' the default card back 2023-10-15 07:25:20 +02:00
LibChess Userland: Prefer _string over _short_string 2023-08-08 07:37:21 +02:00
LibCMake LibSyntax+Userland: Make LibSyntax not depend on LibGUI 2023-08-29 07:57:39 -04:00
LibCodeComprehension AK+Everywhere: Remove the null state of DeprecatedString 2023-10-13 18:33:21 +03:30
LibCompress LibCompress: Avoid buffer overrun when building canonical Huffman code 2023-10-10 13:24:05 +02:00
LibConfig Userland: Convert config listener callbacks to use StringView 2023-06-27 15:37:00 +01:00
LibCore LibCore: Add Resource for platform agnostic application resource loading 2023-10-17 11:02:01 -06:00
LibCoredump LibCore: Make MappedFile OwnPtr-based 2023-09-27 03:22:56 +02:00
LibCpp AK+Everywhere: Remove the null state of DeprecatedString 2023-10-13 18:33:21 +03:30
LibCrypt Everywhere: Resolve conflicts with LibC and libc++ 2023-06-27 12:40:38 +02:00
LibCrypto LibCrypto: Add Chacha20Poly1305 2023-09-26 13:22:04 +03:30
LibDebug AK+Everywhere: Remove the null state of DeprecatedString 2023-10-13 18:33:21 +03:30
LibDesktop Userland: Make GUI::Window construction non-fallible 2023-09-17 16:47:28 -06:00
LibDeviceTree Everywhere: Remove unused DeprecatedString includes 2023-04-09 22:00:54 +02:00
LibDiff LibDiff: Fix wrong index used when prepending context lines 2023-09-11 12:10:50 +01:00
LibDNS AK+Everywhere: Remove the null state of DeprecatedString 2023-10-13 18:33:21 +03:30
LibDSP Userland: Prefer _string over _short_string 2023-08-08 07:37:21 +02:00
LibEDID LibC+Kernel: Move GPU-related API methods to a LibC header file 2023-09-15 11:05:25 -06:00
LibELF LibELF: Handle TLSDESC relocations in .rela.plt for GNU ld 2023-10-14 19:16:22 +02:00
LibFileSystem LibFileSystem: Replace PATH_MAX usage with heap allocation 2023-09-06 07:14:35 -06:00
LibFileSystemAccessClient AK+Everywhere: Remove the null state of DeprecatedString 2023-10-13 18:33:21 +03:30
LibGemini AK+Everywhere: Remove the null state of DeprecatedString 2023-10-13 18:33:21 +03:30
LibGfx LibGfx: Replace manual offsets when producing WOFF2 loca table 2023-10-22 19:42:22 +02:00
LibGL LibGL: Optimize appends in gl_vertex 2023-10-15 12:14:07 +02:00
LibGLSL LibGLSL: Add tests for GLSL parser 2023-08-18 15:29:48 +02:00
LibGPU LibGL+Lib*GPU: Set model view and projection matrices separately 2023-10-15 12:14:07 +02:00
LibGUI LibGUI+Browser: Move GUI::UrlBox to the Browser application 2023-10-20 07:18:54 +02:00
LibHTTP AK+Everywhere: Remove the null state of DeprecatedString 2023-10-13 18:33:21 +03:30
LibIDL LibIDL: Fix bug where Type::is_json doesn't look at parent interface 2023-08-23 12:11:21 +01:00
LibImageDecoderClient Userland: Return empty if ImageDecoder client receives an invalid frame 2023-10-03 08:33:53 +02:00
LibIMAP LibIMAP: Stop parsing immediately on error 2023-10-13 11:12:18 -06:00
LibIPC Userland: Rename Core::Object to Core::EventReceiver 2023-08-06 20:39:51 +02:00
LibJS LibJS/Date: Ensure YearFromTime(t) holds invariant after approximation 2023-10-23 09:26:55 -04:00
LibKeyboard Everywhere: Remove needless trailing semi-colons after functions 2023-07-08 10:32:56 +01:00
LibLine LibLine: Refresh the line after case-change operations 2023-08-07 22:51:49 +03:30
LibLocale LibLocale: Remove compact currency patterns 2023-09-04 18:22:28 +02:00
LibMain Everywhere: Explicitly link all binaries against the LibC target 2022-11-01 14:49:09 +00:00
LibManual Userland: Prefer _string over _short_string 2023-08-08 07:37:21 +02:00
LibMarkdown Userland: Fix absolute paths in man page links 2023-09-06 15:02:44 +01:00
LibPartition Everywhere: Remove needless trailing semi-colons after functions 2023-07-08 10:32:56 +01:00
LibPCIDB LibCore: Make MappedFile OwnPtr-based 2023-09-27 03:22:56 +02:00
LibPDF LibPDF: Don't crash on fixed-width type 1 fonts that use /MissingWidth 2023-10-23 09:33:03 -04:00
LibProtocol Ladybird: Add WebSocket server for use by Lagom networking 2023-08-03 09:55:20 +02:00
LibRegex LibRegex: Don't add the Repeat instruction size to its jump target 2023-09-15 18:07:23 +03:30
LibSanitizer LibSanitizer: Add _abort variants of UBSan handlers 2023-08-13 05:14:07 +02:00
LibSoftGPU LibSoftGPU: Optimize GPU::Vertex lists 2023-10-15 12:14:07 +02:00
LibSQL AK+Everywhere: Remove the null state of DeprecatedString 2023-10-13 18:33:21 +03:30
LibSymbolication LibCore: Make MappedFile OwnPtr-based 2023-09-27 03:22:56 +02:00
LibSyntax LibSyntax+Userland: Make LibSyntax not depend on LibGUI 2023-08-29 07:57:39 -04:00
LibSystem Everywhere: Resolve conflicts with LibC and libc++ 2023-06-27 12:40:38 +02:00
LibTest LibTest: Remove the redefinition of VERIFY family of macros 2023-10-17 18:41:19 -04:00
LibTextCodec LibTextCodec: Add "get output encoding" from the Encoding specification 2023-06-19 06:12:26 +02:00
LibThreading LibThreading: Make Thread keep itself alive while its action is running 2023-08-07 10:40:34 -06:00
LibTimeZone LibTimeZone+Userland: Include Link entries when returning all time zones 2023-10-05 17:01:02 +02:00
LibTLS AK+Everywhere: Remove the null state of DeprecatedString 2023-10-13 18:33:21 +03:30
LibUnicode LibWeb: Implement text-transform: capitalize 2023-10-03 09:47:17 -04:00
LibUSBDB LibCore: Make MappedFile OwnPtr-based 2023-09-27 03:22:56 +02:00
LibVideo LibVideo/VP9: Ensure color space is not set to reserved value 2023-10-11 14:35:47 -04:00
LibVirtGPU LibGL+Lib*GPU: Set model view and projection matrices separately 2023-10-15 12:14:07 +02:00
LibVT LibVT: Clear the href ID by setting it to None instead of "" 2023-10-17 11:02:48 -06:00
LibWasm LibWasm: Make sure to place imported functions before the module's 2023-09-26 07:47:20 +03:30
LibWeb AK: Remove rarely used ExtraMathConstants.h 2023-10-23 12:04:51 +01:00
LibWebSocket LibWebSocket: Adds capability for receiving fragmented messages 2023-09-09 10:59:59 -06:00
LibWebView LibWebView: Add method to break a URL into parts for eTLD+1 highlighting 2023-10-20 07:18:54 +02:00
LibX86 LibX86: Remove i686 support 2022-12-28 11:53:41 +01:00
LibXML LibXML: Set parents for text and comment nodes 2023-08-18 08:58:51 +03:30
CMakeLists.txt LibWebView+LibPublicSuffix: Merge LibPublicSuffix into LibWebView 2023-10-16 09:06:02 -04:00