diff --git a/Tests/LibCompress/TestBrotli.cpp b/Tests/LibCompress/TestBrotli.cpp index bff42326f50..5c4e9788123 100644 --- a/Tests/LibCompress/TestBrotli.cpp +++ b/Tests/LibCompress/TestBrotli.cpp @@ -75,6 +75,11 @@ TEST_CASE(brotli_decompress_katica_regular_10_font) run_test("KaticaRegular10.font"sv); } +TEST_CASE(brotli_single_z) +{ + run_test("single-z.txt"sv); +} + TEST_CASE(brotli_decompress_zero_one_bin) { // This makes sure that the tests will run both on target and in Lagom. diff --git a/Tests/LibCompress/brotli-test-files/single-z.txt b/Tests/LibCompress/brotli-test-files/single-z.txt new file mode 100644 index 00000000000..0f137124110 --- /dev/null +++ b/Tests/LibCompress/brotli-test-files/single-z.txt @@ -0,0 +1 @@ +Z \ No newline at end of file diff --git a/Tests/LibCompress/brotli-test-files/single-z.txt.br b/Tests/LibCompress/brotli-test-files/single-z.txt.br new file mode 100644 index 00000000000..8eb59f49399 Binary files /dev/null and b/Tests/LibCompress/brotli-test-files/single-z.txt.br differ diff --git a/Userland/Libraries/LibCompress/Brotli.cpp b/Userland/Libraries/LibCompress/Brotli.cpp index faae273bbec..2f150fea816 100644 --- a/Userland/Libraries/LibCompress/Brotli.cpp +++ b/Userland/Libraries/LibCompress/Brotli.cpp @@ -605,7 +605,7 @@ ErrorOr BrotliDecompressionStream::read(Bytes output_buffer) return Error::from_string_literal("invalid reserved bit"); size_t skip_bytes = TRY(m_input_stream.read_bits(2)); - size_t skip_length = TRY(m_input_stream.read_bits(8 * skip_bytes)); + size_t skip_length = 1 + TRY(m_input_stream.read_bits(8 * skip_bytes)); u8 remainder = m_input_stream.align_to_byte_boundary(); if (remainder != 0)