diff --git a/AK/LsanSuppressions.h b/AK/LsanSuppressions.h new file mode 100644 index 00000000000..4049f7d4542 --- /dev/null +++ b/AK/LsanSuppressions.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2024, Aliaksandr Kalenik + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include + +#ifdef HAS_ADDRESS_SANITIZER +extern "C" { +char const* __lsan_default_suppressions(); +char const* __lsan_default_suppressions() +{ + // Both Skia and Chromium suppress false positive FontConfig leaks + // https://github.com/google/skia/blob/main/tools/LsanSuppressions.cpp#L20 + // https://chromium.googlesource.com/chromium/src/build/+/master/sanitizers/lsan_suppressions.cc#25 + return "leak:FcPatternObjectInsertElt"; +} +} +#endif diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt index 2919155ddda..1cd1b660932 100644 --- a/Meta/Lagom/CMakeLists.txt +++ b/Meta/Lagom/CMakeLists.txt @@ -523,7 +523,6 @@ if (BUILD_TESTING) list(APPEND TEST_DIRECTORIES LibGfx LibMedia - LibTTF LibWeb LibWebView ) diff --git a/Meta/Lagom/Fuzzers/FuzzTTF.cpp b/Meta/Lagom/Fuzzers/FuzzTTF.cpp deleted file mode 100644 index a194c74f2f2..00000000000 --- a/Meta/Lagom/Fuzzers/FuzzTTF.cpp +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2021, the SerenityOS developers. - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include -#include -#include - -extern "C" int LLVMFuzzerTestOneInput(u8 const* data, size_t size) -{ - AK::set_debug_enabled(false); - (void)OpenType::Typeface::try_load_from_externally_owned_memory({ data, size }); - return 0; -} diff --git a/Meta/Lagom/Fuzzers/fuzzers.cmake b/Meta/Lagom/Fuzzers/fuzzers.cmake index 57550252d8d..39aae6ec975 100644 --- a/Meta/Lagom/Fuzzers/fuzzers.cmake +++ b/Meta/Lagom/Fuzzers/fuzzers.cmake @@ -36,7 +36,6 @@ set(FUZZER_TARGETS Tar TextDecoder TIFFLoader - TTF TinyVGLoader URL WasmParser diff --git a/Tests/LibTTF/CMakeLists.txt b/Tests/LibTTF/CMakeLists.txt deleted file mode 100644 index a88509d8cbe..00000000000 --- a/Tests/LibTTF/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -set(TEST_SOURCES - TestCmap.cpp -) - -foreach(source IN LISTS TEST_SOURCES) - serenity_test("${source}" LibTTF LIBS LibGfx) -endforeach() diff --git a/Tests/LibTTF/TestCmap.cpp b/Tests/LibTTF/TestCmap.cpp deleted file mode 100644 index 50918efaf07..00000000000 --- a/Tests/LibTTF/TestCmap.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2022, Nico Weber - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include -#include - -TEST_CASE(test_cmap_format_4) -{ - // clang-format off - // Big endian. - Array const cmap_table = - { - // https://docs.microsoft.com/en-us/typography/opentype/spec/cmap#cmap-header - 0, 0, // uint16 version - 0, 1, // uint16 numTables - - // https://docs.microsoft.com/en-us/typography/opentype/spec/cmap#encoding-records-and-encodings - 0, 0, // uint16 platformID, 0 means "Unicode" - 0, 3, // uint16 encodingID, 3 means "BMP only" for platformID==0. - 0, 0, 0, 12, // Offset32 to encoding subtable. - - // https://docs.microsoft.com/en-us/typography/opentype/spec/cmap#format-4-segment-mapping-to-delta-values - 0, 4, // uint16 format = 4 - 0, 42, // uint16 length in bytes - 0, 0, // uint16 language, must be 0 - 0, 6, // segCount * 2 - 0, 4, // searchRange - 0, 1, // entrySelector - 0, 2, // rangeShift - - // endCode array, last entry must be 0xffff. - 0, 128, - 1, 0, - 0xff, 0xff, - - 0, 0, // uint16 reservedPad - - // startCode array - 0, 16, - 1, 0, - 0xff, 0xff, - - // delta array - 0, 0, - 0, 10, - 0, 0, - - // glyphID array - 0, 0, - 0, 0, - 0, 0, - }; - // clang-format on - auto cmap = OpenType::Cmap::from_slice(cmap_table.span()).value(); - cmap.set_active_index(0); - - // Format 4 can't handle code points > 0xffff. - - // First range is 16..128. - EXPECT_EQ(cmap.glyph_id_for_code_point(15), 0u); - EXPECT_EQ(cmap.glyph_id_for_code_point(16), 16u); - EXPECT_EQ(cmap.glyph_id_for_code_point(128), 128u); - EXPECT_EQ(cmap.glyph_id_for_code_point(129), 0u); - - // Second range is 256..256, with delta 10. - EXPECT_EQ(cmap.glyph_id_for_code_point(255), 0u); - EXPECT_EQ(cmap.glyph_id_for_code_point(256), 266u); - EXPECT_EQ(cmap.glyph_id_for_code_point(257), 0u); - - // Third range is 0xffff..0xffff. - // From https://docs.microsoft.com/en-us/typography/opentype/spec/cmap#format-4-segment-mapping-to-delta-values: - // "the final start code and endCode values must be 0xFFFF. This segment need not contain any valid mappings. - // (It can just map the single character code 0xFFFF to missingGlyph). However, the segment must be present." - // FIXME: Make OpenType::Cmap::from_slice() reject inputs where this isn't true. - EXPECT_EQ(cmap.glyph_id_for_code_point(0xfeff), 0u); - EXPECT_EQ(cmap.glyph_id_for_code_point(0xffff), 0xffffu); - EXPECT_EQ(cmap.glyph_id_for_code_point(0x1'0000), 0u); - - // Set the number of subtables to a value, where the record offset for the last subtable is greater than the - // total table size. We should not crash if a Cmap table is truncated in this way. - auto malformed_cmap_table = cmap_table; - malformed_cmap_table[3] = 13; - auto cmap_with_invalid_subtable_offset = OpenType::Cmap::from_slice(malformed_cmap_table.span()).value(); - EXPECT(!cmap_with_invalid_subtable_offset.subtable(12).has_value()); -} diff --git a/Tests/LibWeb/Layout/expected/css-line-height-zero.txt b/Tests/LibWeb/Layout/expected/css-line-height-zero.txt index 09edc7d5dbd..1148afdbe10 100644 --- a/Tests/LibWeb/Layout/expected/css-line-height-zero.txt +++ b/Tests/LibWeb/Layout/expected/css-line-height-zero.txt @@ -1,10 +1,10 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline BlockContainer at (0,0) content-size 800x37 [BFC] children: not-inline BlockContainer at (8,8) content-size 784x21 children: inline - frag 0 from BlockContainer start: 0, length: 0, rect: [9,9 191.875x19] baseline: 14.296875 - BlockContainer at (9,9) content-size 191.875x19 inline-block [BFC] children: not-inline - Box
at (11,10) content-size 187.875x17 flex-container(row) [FFC] children: not-inline - BlockContainer
at (11,10) content-size 187.875x17 flex-item [BFC] children: inline + frag 0 from BlockContainer start: 0, length: 0, rect: [9,9 200x19] baseline: 14.296875 + BlockContainer at (9,9) content-size 200x19 inline-block [BFC] children: not-inline + Box
at (11,10) content-size 196x17 flex-container(row) [FFC] children: not-inline + BlockContainer
at (11,10) content-size 196x17 flex-item [BFC] children: inline frag 0 from TextNode start: 0, length: 11, rect: [11,10 91.953125x17] baseline: 13.296875 "Hello World" TextNode <#text> @@ -13,7 +13,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline ViewportPaintable (Viewport<#document>) [0,0 800x600] PaintableWithLines (BlockContainer) [0,0 800x37] PaintableWithLines (BlockContainer) [8,8 784x21] - PaintableWithLines (BlockContainer) [8,8 193.875x21] - PaintableBox (Box
) [9,9 191.875x19] - PaintableWithLines (BlockContainer
) [11,10 187.875x17] + PaintableWithLines (BlockContainer) [8,8 202x21] + PaintableBox (Box
) [9,9 200x19] + PaintableWithLines (BlockContainer
) [11,10 196x17] TextPaintable (TextNode<#text>) diff --git a/Tests/LibWeb/Layout/expected/css-pseudo-element-blockification.txt b/Tests/LibWeb/Layout/expected/css-pseudo-element-blockification.txt index 95f1003facb..91ebfa94a26 100644 --- a/Tests/LibWeb/Layout/expected/css-pseudo-element-blockification.txt +++ b/Tests/LibWeb/Layout/expected/css-pseudo-element-blockification.txt @@ -6,12 +6,12 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline frag 0 from TextNode start: 0, length: 4, rect: [8,8 28.40625x17] baseline: 13.296875 "well" TextNode <#text> - BlockContainer <(anonymous)> at (46,8) content-size 36.84375x17 flex-item [BFC] children: inline - frag 0 from TextNode start: 0, length: 5, rect: [46,8 36.84375x17] baseline: 13.296875 + BlockContainer <(anonymous)> at (46.40625,8) content-size 36.84375x17 flex-item [BFC] children: inline + frag 0 from TextNode start: 0, length: 5, rect: [46.40625,8 36.84375x17] baseline: 13.296875 "hello" TextNode <#text> - BlockContainer <(anonymous)> at (92.4375,8) content-size 55.359375x17 flex-item [BFC] children: inline - frag 0 from TextNode start: 0, length: 7, rect: [92.4375,8 55.359375x17] baseline: 13.296875 + BlockContainer <(anonymous)> at (93.25,8) content-size 55.359375x17 flex-item [BFC] children: inline + frag 0 from TextNode start: 0, length: 7, rect: [93.25,8 55.359375x17] baseline: 13.296875 "friends" TextNode <#text> @@ -21,7 +21,7 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] PaintableBox (Box
.foo) [8,8 784x17] PaintableWithLines (BlockContainer(anonymous)) [8,8 28.40625x17] TextPaintable (TextNode<#text>) - PaintableWithLines (BlockContainer(anonymous)) [46,8 36.84375x17] + PaintableWithLines (BlockContainer(anonymous)) [46.40625,8 36.84375x17] TextPaintable (TextNode<#text>) - PaintableWithLines (BlockContainer(anonymous)) [92.4375,8 55.359375x17] + PaintableWithLines (BlockContainer(anonymous)) [93.25,8 55.359375x17] TextPaintable (TextNode<#text>) diff --git a/Tests/LibWeb/Layout/expected/font-size-zero.txt b/Tests/LibWeb/Layout/expected/font-size-zero.txt index 4caf892bac5..30a2b5ab2d4 100644 --- a/Tests/LibWeb/Layout/expected/font-size-zero.txt +++ b/Tests/LibWeb/Layout/expected/font-size-zero.txt @@ -1,13 +1,13 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline - BlockContainer at (0,0) content-size 800x16 [BFC] children: not-inline - BlockContainer at (8,8) content-size 784x0 children: not-inline - BlockContainer
at (8,8) content-size 784x0 children: inline - frag 0 from TextNode start: 0, length: 21, rect: [8,8 0x0] baseline: 0 + BlockContainer at (0,0) content-size 800x17 [BFC] children: not-inline + BlockContainer at (8,8) content-size 784x1 children: not-inline + BlockContainer
at (8,8) content-size 784x1 children: inline + frag 0 from TextNode start: 0, length: 21, rect: [8,8 0x1] baseline: 0.796875 "should not be visible" TextNode <#text> ViewportPaintable (Viewport<#document>) [0,0 800x600] - PaintableWithLines (BlockContainer) [0,0 800x16] - PaintableWithLines (BlockContainer) [8,8 784x0] - PaintableWithLines (BlockContainer
) [8,8 784x0] + PaintableWithLines (BlockContainer) [0,0 800x17] + PaintableWithLines (BlockContainer) [8,8 784x1] + PaintableWithLines (BlockContainer
) [8,8 784x1] TextPaintable (TextNode<#text>) diff --git a/Tests/LibWeb/Layout/expected/input-image-to-text.txt b/Tests/LibWeb/Layout/expected/input-image-to-text.txt index ffe2e0538ef..c0616c00612 100644 --- a/Tests/LibWeb/Layout/expected/input-image-to-text.txt +++ b/Tests/LibWeb/Layout/expected/input-image-to-text.txt @@ -1,10 +1,10 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline BlockContainer at (0,0) content-size 800x600 [BFC] children: not-inline BlockContainer at (8,8) content-size 784x21 children: inline - frag 0 from BlockContainer start: 0, length: 0, rect: [9,9 189.875x19] baseline: 14.296875 - BlockContainer at (9,9) content-size 189.875x19 inline-block [BFC] children: not-inline - Box
at (11,10) content-size 185.875x17 flex-container(row) [FFC] children: not-inline - BlockContainer
at (11,10) content-size 185.875x17 flex-item [BFC] children: inline + frag 0 from BlockContainer start: 0, length: 0, rect: [9,9 198x19] baseline: 14.296875 + BlockContainer at (9,9) content-size 198x19 inline-block [BFC] children: not-inline + Box
at (11,10) content-size 194x17 flex-container(row) [FFC] children: not-inline + BlockContainer
at (11,10) content-size 194x17 flex-item [BFC] children: inline frag 0 from TextNode start: 0, length: 7, rect: [11,10 55.6875x17] baseline: 13.296875 "120.png" TextNode <#text> @@ -14,7 +14,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline ViewportPaintable (Viewport<#document>) [0,0 800x600] PaintableWithLines (BlockContainer) [0,0 800x600] PaintableWithLines (BlockContainer) [8,8 784x21] - PaintableWithLines (BlockContainer) [8,8 191.875x21] - PaintableBox (Box
) [9,9 189.875x19] - PaintableWithLines (BlockContainer
) [11,10 185.875x17] + PaintableWithLines (BlockContainer) [8,8 200x21] + PaintableBox (Box
) [9,9 198x19] + PaintableWithLines (BlockContainer
) [11,10 194x17] TextPaintable (TextNode<#text>) diff --git a/Tests/LibWeb/Layout/expected/input-password-to-text.txt b/Tests/LibWeb/Layout/expected/input-password-to-text.txt index d76b40bd166..4c71a0be7c7 100644 --- a/Tests/LibWeb/Layout/expected/input-password-to-text.txt +++ b/Tests/LibWeb/Layout/expected/input-password-to-text.txt @@ -1,10 +1,10 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline BlockContainer at (0,0) content-size 800x600 [BFC] children: not-inline BlockContainer at (8,8) content-size 784x21 children: inline - frag 0 from BlockContainer start: 0, length: 0, rect: [9,9 189.875x19] baseline: 14.296875 - BlockContainer at (9,9) content-size 189.875x19 inline-block [BFC] children: not-inline - Box
at (11,10) content-size 185.875x17 flex-container(row) [FFC] children: not-inline - BlockContainer
at (11,10) content-size 185.875x17 flex-item [BFC] children: inline + frag 0 from BlockContainer start: 0, length: 0, rect: [9,9 198x19] baseline: 14.296875 + BlockContainer at (9,9) content-size 198x19 inline-block [BFC] children: not-inline + Box
at (11,10) content-size 194x17 flex-container(row) [FFC] children: not-inline + BlockContainer
at (11,10) content-size 194x17 flex-item [BFC] children: inline frag 0 from TextNode start: 0, length: 7, rect: [11,10 61.890625x17] baseline: 13.296875 "hunter2" TextNode <#text> @@ -14,7 +14,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline ViewportPaintable (Viewport<#document>) [0,0 800x600] PaintableWithLines (BlockContainer) [0,0 800x600] PaintableWithLines (BlockContainer) [8,8 784x21] - PaintableWithLines (BlockContainer) [8,8 191.875x21] - PaintableBox (Box
) [9,9 189.875x19] - PaintableWithLines (BlockContainer
) [11,10 185.875x17] + PaintableWithLines (BlockContainer) [8,8 200x21] + PaintableBox (Box
) [9,9 198x19] + PaintableWithLines (BlockContainer
) [11,10 194x17] TextPaintable (TextNode<#text>) diff --git a/Tests/LibWeb/Layout/expected/input-text-to-password.txt b/Tests/LibWeb/Layout/expected/input-text-to-password.txt index 1d9745779ac..38c00270d37 100644 --- a/Tests/LibWeb/Layout/expected/input-text-to-password.txt +++ b/Tests/LibWeb/Layout/expected/input-text-to-password.txt @@ -1,10 +1,10 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline BlockContainer at (0,0) content-size 800x600 [BFC] children: not-inline BlockContainer at (8,8) content-size 784x21 children: inline - frag 0 from BlockContainer start: 0, length: 0, rect: [9,9 189.875x19] baseline: 14.296875 - BlockContainer at (9,9) content-size 189.875x19 inline-block [BFC] children: not-inline - Box
at (11,10) content-size 185.875x17 flex-container(row) [FFC] children: not-inline - BlockContainer
at (11,10) content-size 185.875x17 flex-item [BFC] children: inline + frag 0 from BlockContainer start: 0, length: 0, rect: [9,9 198x19] baseline: 14.296875 + BlockContainer at (9,9) content-size 198x19 inline-block [BFC] children: not-inline + Box
at (11,10) content-size 194x17 flex-container(row) [FFC] children: not-inline + BlockContainer
at (11,10) content-size 194x17 flex-item [BFC] children: inline frag 0 from TextNode start: 0, length: 7, rect: [11,10 55.5625x17] baseline: 13.296875 "*******" TextNode <#text> @@ -14,7 +14,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline ViewportPaintable (Viewport<#document>) [0,0 800x600] PaintableWithLines (BlockContainer) [0,0 800x600] PaintableWithLines (BlockContainer) [8,8 784x21] - PaintableWithLines (BlockContainer) [8,8 191.875x21] - PaintableBox (Box
) [9,9 189.875x19] - PaintableWithLines (BlockContainer
) [11,10 185.875x17] + PaintableWithLines (BlockContainer) [8,8 200x21] + PaintableBox (Box
) [9,9 198x19] + PaintableWithLines (BlockContainer
) [11,10 194x17] TextPaintable (TextNode<#text>) diff --git a/Tests/LibWeb/Layout/expected/textarea-reset.txt b/Tests/LibWeb/Layout/expected/textarea-reset.txt index 840f3f926da..5dd248b4a72 100644 --- a/Tests/LibWeb/Layout/expected/textarea-reset.txt +++ b/Tests/LibWeb/Layout/expected/textarea-reset.txt @@ -2,11 +2,11 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline BlockContainer at (0,0) content-size 800x600 [BFC] children: not-inline BlockContainer at (8,8) content-size 784x34 children: not-inline BlockContainer at (8,8) content-size 784x34 children: inline - frag 0 from BlockContainer start: 0, length: 0, rect: [11,11 185.875x28] baseline: 16.296875 + frag 0 from BlockContainer start: 0, length: 0, rect: [11,11 194x28] baseline: 16.296875 TextNode <#text> - BlockContainer at (11,11) content-size 185.875x28 inline-block [BFC] children: not-inline - BlockContainer
at (11,11) content-size 185.875x17 children: not-inline - BlockContainer
at (11,11) content-size 185.875x17 children: inline + BlockContainer at (11,11) content-size 194x28 inline-block [BFC] children: not-inline + BlockContainer
at (11,11) content-size 194x17 children: not-inline + BlockContainer
at (11,11) content-size 194x17 children: inline frag 0 from TextNode start: 0, length: 14, rect: [11,11 108.453125x17] baseline: 13.296875 "Original value" TextNode <#text> @@ -19,8 +19,8 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] PaintableWithLines (BlockContainer) [0,0 800x600] PaintableWithLines (BlockContainer) [8,8 784x34] overflow: [8,8 784x50] PaintableWithLines (BlockContainer
#form) [8,8 784x34] - PaintableWithLines (BlockContainer