TestLzma.cpp 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. /*
  2. * Copyright (c) 2023, Tim Schumacher <timschumi@gmx.de>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibTest/TestCase.h>
  7. #include <AK/MemoryStream.h>
  8. #include <LibCompress/Lzma.h>
  9. TEST_CASE(repetition_length_beyond_distance)
  10. {
  11. // This test exists to ensure correctness when repeating data from the dictionary that has been
  12. // written earlier during the same repetition.
  13. // While this test case is not large enough to testify how well this is optimized, it may still
  14. // be a constellation that is improperly implemented as a whole.
  15. Array<u8, 21> const compressed {
  16. 0x5D, // Model properties (lc = 3, lp = 0, pb = 2)
  17. 0x00, 0x10, 0x00, 0x00, // Dictionary size (4 KB)
  18. 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Uncompressed size (7)
  19. // Encode a literal 'A' and a literal 'B', followed by a repetition from (real) distance 2 with a (real) length of 5.
  20. 0x00, 0x20, 0x90, 0x9F, 0x04, 0x00, 0x00, 0x00
  21. };
  22. auto stream = MUST(try_make<FixedMemoryStream>(compressed));
  23. auto decompressor = MUST(Compress::LzmaDecompressor::create_from_container(move(stream)));
  24. auto buffer = TRY_OR_FAIL(decompressor->read_until_eof(PAGE_SIZE));
  25. EXPECT_EQ("ABABABA"sv.bytes(), buffer.span());
  26. }
  27. TEST_CASE(compress_decompress_roundtrip_with_known_size)
  28. {
  29. auto const uncompressed = "Well hello friends, this is a simple text file :)"sv.bytes();
  30. auto stream = MUST(try_make<AllocatingMemoryStream>());
  31. Compress::LzmaCompressorOptions const compressor_options {
  32. .literal_context_bits = 3,
  33. .literal_position_bits = 0,
  34. .position_bits = 2,
  35. .dictionary_size = 4 * KiB,
  36. .uncompressed_size = uncompressed.size(),
  37. };
  38. auto compressor = TRY_OR_FAIL(Compress::LzmaCompressor::create_container(MaybeOwned<Stream> { *stream }, compressor_options));
  39. TRY_OR_FAIL(compressor->write_until_depleted(uncompressed));
  40. auto decompressor = TRY_OR_FAIL(Compress::LzmaDecompressor::create_from_container(MaybeOwned<Stream> { *stream }));
  41. auto result = TRY_OR_FAIL(decompressor->read_until_eof());
  42. EXPECT_EQ(uncompressed, result.span());
  43. }
  44. TEST_CASE(compress_decompress_roundtrip_with_unknown_size)
  45. {
  46. auto const uncompressed = "Well hello friends, this is a simple text file :)"sv.bytes();
  47. auto stream = MUST(try_make<AllocatingMemoryStream>());
  48. Compress::LzmaCompressorOptions const compressor_options {
  49. .literal_context_bits = 3,
  50. .literal_position_bits = 0,
  51. .position_bits = 2,
  52. .dictionary_size = 4 * KiB,
  53. };
  54. auto compressor = TRY_OR_FAIL(Compress::LzmaCompressor::create_container(MaybeOwned<Stream> { *stream }, compressor_options));
  55. TRY_OR_FAIL(compressor->write_until_depleted(uncompressed));
  56. TRY_OR_FAIL(compressor->flush());
  57. auto decompressor = TRY_OR_FAIL(Compress::LzmaDecompressor::create_from_container(MaybeOwned<Stream> { *stream }));
  58. auto result = TRY_OR_FAIL(decompressor->read_until_eof());
  59. EXPECT_EQ(uncompressed, result.span());
  60. }
  61. TEST_CASE(compress_long_overflow_chain)
  62. {
  63. // Encoding 0xFF followed by the end-of-stream marker results in a chain of bytes that doesn't fit into 64 bits,
  64. // which breaks naive implementations of "hold back the byte until it no longer changes".
  65. Array<u8, 1> const uncompressed {
  66. 0xFF
  67. };
  68. auto stream = MUST(try_make<AllocatingMemoryStream>());
  69. auto compressor = TRY_OR_FAIL(Compress::LzmaCompressor::create_container(MaybeOwned<Stream> { *stream }, {}));
  70. TRY_OR_FAIL(compressor->write_until_depleted(uncompressed));
  71. TRY_OR_FAIL(compressor->flush());
  72. auto decompressor = TRY_OR_FAIL(Compress::LzmaDecompressor::create_from_container(MaybeOwned<Stream> { *stream }));
  73. auto result = TRY_OR_FAIL(decompressor->read_until_eof());
  74. EXPECT_EQ(uncompressed, result.span());
  75. }
  76. // The following tests are based on test files from the LZMA specification, which has been placed in the public domain.
  77. // LZMA Specification Draft (2015): https://www.7-zip.org/a/lzma-specification.7z
  78. Array<u8, 327> const specification_a_txt {
  79. 0x4C, 0x5A, 0x4D, 0x41, 0x20, 0x64, 0x65, 0x63, 0x6F, 0x64, 0x65, 0x72, 0x20, 0x74, 0x65, 0x73,
  80. 0x74, 0x20, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x0D, 0x0A, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D,
  81. 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D,
  82. 0x3D, 0x3D, 0x3D, 0x3D, 0x0D, 0x0A, 0x21, 0x20, 0x4C, 0x5A, 0x4D, 0x41, 0x20, 0x21, 0x20, 0x44,
  83. 0x65, 0x63, 0x6F, 0x64, 0x65, 0x72, 0x20, 0x21, 0x20, 0x54, 0x45, 0x53, 0x54, 0x20, 0x21, 0x0D,
  84. 0x0A, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D,
  85. 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x0D, 0x0A, 0x21, 0x20, 0x54, 0x45,
  86. 0x53, 0x54, 0x20, 0x21, 0x20, 0x4C, 0x5A, 0x4D, 0x41, 0x20, 0x21, 0x20, 0x44, 0x65, 0x63, 0x6F,
  87. 0x64, 0x65, 0x72, 0x20, 0x21, 0x0D, 0x0A, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D,
  88. 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D,
  89. 0x0D, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x4C, 0x69, 0x6E, 0x65,
  90. 0x20, 0x31, 0x20, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x20, 0x0D, 0x0A, 0x3D, 0x3D,
  91. 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D,
  92. 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x0D, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x20, 0x54, 0x65,
  93. 0x73, 0x74, 0x20, 0x4C, 0x69, 0x6E, 0x65, 0x20, 0x32, 0x20, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D,
  94. 0x2D, 0x2D, 0x20, 0x0D, 0x0A, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D,
  95. 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x0D, 0x0A,
  96. 0x3D, 0x3D, 0x3D, 0x20, 0x45, 0x6E, 0x64, 0x20, 0x6F, 0x66, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20,
  97. 0x66, 0x69, 0x6C, 0x65, 0x20, 0x3D, 0x3D, 0x3D, 0x3D, 0x20, 0x0D, 0x0A, 0x3D, 0x3D, 0x3D, 0x3D,
  98. 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D,
  99. 0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0x0D, 0x0A
  100. };
  101. TEST_CASE(specification_a_lzma_decompress)
  102. {
  103. Array<u8, 117> const compressed {
  104. 0x5D, 0x00, 0x00, 0x80, 0x00, 0x47, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x16,
  105. 0x85, 0xBC, 0x45, 0xF0, 0xDF, 0xFF, 0xD2, 0xE8, 0x41, 0xF5, 0xCE, 0xE5, 0x90, 0xE1, 0xC8, 0x20,
  106. 0xEA, 0xC6, 0x37, 0xBE, 0x2B, 0xD1, 0xF4, 0xC3, 0x34, 0x6F, 0x2F, 0x83, 0xC2, 0xA6, 0x7C, 0x6F,
  107. 0x3D, 0x88, 0xA0, 0x58, 0x22, 0x1F, 0x3A, 0xBA, 0x7B, 0xC6, 0xDD, 0x66, 0xFE, 0xF8, 0x92, 0xE4,
  108. 0xCB, 0x1C, 0xC4, 0x19, 0x0A, 0x0C, 0x8B, 0x2E, 0x39, 0xB8, 0xB8, 0x03, 0xCD, 0x5A, 0x9E, 0x10,
  109. 0x3A, 0x4F, 0x65, 0xFA, 0x41, 0xCB, 0xF2, 0x79, 0x65, 0xD7, 0xF1, 0x9F, 0xAB, 0x70, 0x1D, 0x6F,
  110. 0xF7, 0xB6, 0x79, 0xCC, 0x8A, 0x7D, 0xCE, 0xDB, 0xF8, 0xF6, 0x9E, 0xC9, 0x12, 0x9F, 0xAA, 0xBF,
  111. 0x89, 0xFE, 0x05, 0x36, 0x80
  112. };
  113. auto stream = MUST(try_make<FixedMemoryStream>(compressed));
  114. auto decompressor = MUST(Compress::LzmaDecompressor::create_from_container(move(stream)));
  115. auto buffer = TRY_OR_FAIL(decompressor->read_until_eof(PAGE_SIZE));
  116. EXPECT_EQ(specification_a_txt, buffer.span());
  117. }
  118. TEST_CASE(specification_a_eos_lzma_decompress)
  119. {
  120. Array<u8, 122> const compressed {
  121. 0x5D, 0x00, 0x00, 0x01, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x26, 0x16,
  122. 0x85, 0xBC, 0x45, 0xF0, 0xDF, 0xFF, 0xD2, 0xE8, 0x41, 0xF5, 0xCE, 0xE5, 0x90, 0xE1, 0xC8, 0x20,
  123. 0xEA, 0xC6, 0x37, 0xBE, 0x2B, 0xD1, 0xF4, 0xC3, 0x34, 0x6F, 0x2F, 0x83, 0xC2, 0xA6, 0x7C, 0x6F,
  124. 0x3D, 0x88, 0xA0, 0x58, 0x22, 0x1F, 0x3A, 0xBA, 0x7B, 0xC6, 0xDD, 0x66, 0xFE, 0xF8, 0x92, 0xE4,
  125. 0xCB, 0x1C, 0xC4, 0x19, 0x0A, 0x0C, 0x8B, 0x2E, 0x39, 0xB8, 0xB8, 0x03, 0xCD, 0x5A, 0x9E, 0x10,
  126. 0x3A, 0x4F, 0x65, 0xFA, 0x41, 0xCB, 0xF2, 0x79, 0x65, 0xD7, 0xF1, 0x9F, 0xAB, 0x70, 0x1D, 0x6F,
  127. 0xF7, 0xB6, 0x79, 0xCC, 0x8A, 0x7D, 0xCE, 0xDB, 0xF8, 0xF6, 0x9E, 0xC9, 0x12, 0x9F, 0xAA, 0xBF,
  128. 0x8A, 0x08, 0xF5, 0x99, 0x8D, 0x7F, 0xFA, 0x18, 0x0A, 0x52
  129. };
  130. auto stream = MUST(try_make<FixedMemoryStream>(compressed));
  131. auto decompressor = MUST(Compress::LzmaDecompressor::create_from_container(move(stream)));
  132. auto buffer = TRY_OR_FAIL(decompressor->read_until_eof(PAGE_SIZE));
  133. EXPECT_EQ(specification_a_txt, buffer.span());
  134. }
  135. TEST_CASE(specification_a_eos_and_size_lzma_decompress)
  136. {
  137. Array<u8, 122> const compressed {
  138. 0x5D, 0x00, 0x00, 0x01, 0x00, 0x47, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x16,
  139. 0x85, 0xBC, 0x45, 0xF0, 0xDF, 0xFF, 0xD2, 0xE8, 0x41, 0xF5, 0xCE, 0xE5, 0x90, 0xE1, 0xC8, 0x20,
  140. 0xEA, 0xC6, 0x37, 0xBE, 0x2B, 0xD1, 0xF4, 0xC3, 0x34, 0x6F, 0x2F, 0x83, 0xC2, 0xA6, 0x7C, 0x6F,
  141. 0x3D, 0x88, 0xA0, 0x58, 0x22, 0x1F, 0x3A, 0xBA, 0x7B, 0xC6, 0xDD, 0x66, 0xFE, 0xF8, 0x92, 0xE4,
  142. 0xCB, 0x1C, 0xC4, 0x19, 0x0A, 0x0C, 0x8B, 0x2E, 0x39, 0xB8, 0xB8, 0x03, 0xCD, 0x5A, 0x9E, 0x10,
  143. 0x3A, 0x4F, 0x65, 0xFA, 0x41, 0xCB, 0xF2, 0x79, 0x65, 0xD7, 0xF1, 0x9F, 0xAB, 0x70, 0x1D, 0x6F,
  144. 0xF7, 0xB6, 0x79, 0xCC, 0x8A, 0x7D, 0xCE, 0xDB, 0xF8, 0xF6, 0x9E, 0xC9, 0x12, 0x9F, 0xAA, 0xBF,
  145. 0x8A, 0x08, 0xF5, 0x99, 0x8D, 0x7F, 0xFA, 0x18, 0x0A, 0x52
  146. };
  147. auto stream = MUST(try_make<FixedMemoryStream>(compressed));
  148. auto decompressor = MUST(Compress::LzmaDecompressor::create_from_container(move(stream)));
  149. auto buffer = TRY_OR_FAIL(decompressor->read_until_eof(PAGE_SIZE));
  150. EXPECT_EQ(specification_a_txt, buffer.span());
  151. }
  152. TEST_CASE(specification_a_lp1_lc2_pb1_lzma_decompress)
  153. {
  154. // Note: The name of this test file (and the accompanying info.txt) is wrong. It is encoded with lc = 1 instead of lc = 2.
  155. Array<u8, 117> const compressed {
  156. 0x37, 0x00, 0x00, 0x01, 0x00, 0x47, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x16,
  157. 0x86, 0x23, 0xBC, 0x5C, 0xC9, 0x40, 0x2B, 0x6B, 0x91, 0x5B, 0xCD, 0x90, 0x40, 0xCB, 0x9A, 0x71,
  158. 0x5B, 0x84, 0x68, 0xE0, 0x5A, 0xAB, 0xA3, 0xE9, 0x04, 0xF7, 0xA3, 0xA6, 0x8E, 0x5F, 0xAA, 0x24,
  159. 0x8B, 0xFC, 0x20, 0x38, 0xA6, 0xB7, 0x2A, 0x47, 0xAF, 0x07, 0xF7, 0x14, 0xAC, 0xE8, 0xB4, 0xD9,
  160. 0x96, 0x27, 0xE0, 0xF4, 0x47, 0x8D, 0xE9, 0xDD, 0x05, 0x28, 0x1A, 0xDF, 0xB1, 0xED, 0x1A, 0xDC,
  161. 0x0B, 0x55, 0xB2, 0xBD, 0x55, 0x69, 0x6C, 0xD9, 0xFC, 0x70, 0x43, 0xA7, 0x16, 0x58, 0x99, 0xFE,
  162. 0x97, 0x04, 0x11, 0x27, 0x56, 0x5E, 0xC6, 0xB0, 0x4E, 0x31, 0xA0, 0xCB, 0x17, 0x27, 0xEC, 0x72,
  163. 0x36, 0x0E, 0x9A, 0xAD, 0x00
  164. };
  165. auto stream = MUST(try_make<FixedMemoryStream>(compressed));
  166. auto decompressor = MUST(Compress::LzmaDecompressor::create_from_container(move(stream)));
  167. auto buffer = TRY_OR_FAIL(decompressor->read_until_eof(PAGE_SIZE));
  168. EXPECT_EQ(specification_a_txt, buffer.span());
  169. }
  170. TEST_CASE(specification_bad_corrupted_lzma_decompress)
  171. {
  172. Array<u8, 117> const compressed {
  173. 0x5D, 0x00, 0x00, 0x80, 0x00, 0x47, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x16,
  174. 0x85, 0xBC, 0x45, 0xF0, 0xDF, 0xFF, 0xD2, 0xE8, 0x41, 0xF5, 0xCE, 0xE5, 0x90, 0xE1, 0xC8, 0x20,
  175. 0xEA, 0xC6, 0x37, 0xBE, 0x2B, 0xD1, 0xF4, 0xC3, 0x34, 0x6F, 0x2F, 0x83, 0xC2, 0xA6, 0x7C, 0x6F,
  176. 0x3D, 0x88, 0xA0, 0x58, 0x22, 0x1F, 0x3A, 0xBA, 0x7B, 0xC6, 0xDD, 0x66, 0xFE, 0xF8, 0x92, 0xE4,
  177. 0xCB, 0x1C, 0xC4, 0x19, 0x0A, 0x0C, 0x8B, 0x2E, 0x39, 0xB8, 0xB8, 0x03, 0xCD, 0x5A, 0x9E, 0x10,
  178. 0x3A, 0x4F, 0x65, 0xFA, 0x41, 0xCB, 0xF2, 0x79, 0x65, 0xD7, 0xF1, 0xFF, 0xFF, 0xFF, 0x1D, 0x6F,
  179. 0xF7, 0xB6, 0x79, 0xCC, 0x8A, 0x7D, 0xCE, 0xDB, 0xF8, 0xF6, 0x9E, 0xC9, 0x12, 0x9F, 0xAA, 0xBF,
  180. 0x89, 0xFE, 0x05, 0x36, 0x80
  181. };
  182. auto stream = MUST(try_make<FixedMemoryStream>(compressed));
  183. auto decompressor = MUST(Compress::LzmaDecompressor::create_from_container(move(stream)));
  184. auto buffer_or_error = decompressor->read_until_eof(PAGE_SIZE);
  185. EXPECT(buffer_or_error.is_error());
  186. }
  187. TEST_CASE(specification_bad_eos_incorrect_size_lzma_decompress)
  188. {
  189. Array<u8, 122> const compressed {
  190. 0x5D, 0x00, 0x00, 0x01, 0x00, 0x48, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x16,
  191. 0x85, 0xBC, 0x45, 0xF0, 0xDF, 0xFF, 0xD2, 0xE8, 0x41, 0xF5, 0xCE, 0xE5, 0x90, 0xE1, 0xC8, 0x20,
  192. 0xEA, 0xC6, 0x37, 0xBE, 0x2B, 0xD1, 0xF4, 0xC3, 0x34, 0x6F, 0x2F, 0x83, 0xC2, 0xA6, 0x7C, 0x6F,
  193. 0x3D, 0x88, 0xA0, 0x58, 0x22, 0x1F, 0x3A, 0xBA, 0x7B, 0xC6, 0xDD, 0x66, 0xFE, 0xF8, 0x92, 0xE4,
  194. 0xCB, 0x1C, 0xC4, 0x19, 0x0A, 0x0C, 0x8B, 0x2E, 0x39, 0xB8, 0xB8, 0x03, 0xCD, 0x5A, 0x9E, 0x10,
  195. 0x3A, 0x4F, 0x65, 0xFA, 0x41, 0xCB, 0xF2, 0x79, 0x65, 0xD7, 0xF1, 0x9F, 0xAB, 0x70, 0x1D, 0x6F,
  196. 0xF7, 0xB6, 0x79, 0xCC, 0x8A, 0x7D, 0xCE, 0xDB, 0xF8, 0xF6, 0x9E, 0xC9, 0x12, 0x9F, 0xAA, 0xBF,
  197. 0x8A, 0x08, 0xF5, 0x99, 0x8D, 0x7F, 0xFA, 0x18, 0x0A, 0x52
  198. };
  199. auto stream = MUST(try_make<FixedMemoryStream>(compressed));
  200. auto decompressor = MUST(Compress::LzmaDecompressor::create_from_container(move(stream)));
  201. auto buffer_or_error = decompressor->read_until_eof(PAGE_SIZE);
  202. EXPECT(buffer_or_error.is_error());
  203. }
  204. TEST_CASE(specification_bad_incorrect_size_lzma_decompress)
  205. {
  206. Array<u8, 117> const compressed {
  207. 0x5D, 0x00, 0x00, 0x80, 0x00, 0x22, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x16,
  208. 0x85, 0xBC, 0x45, 0xF0, 0xDF, 0xFF, 0xD2, 0xE8, 0x41, 0xF5, 0xCE, 0xE5, 0x90, 0xE1, 0xC8, 0x20,
  209. 0xEA, 0xC6, 0x37, 0xBE, 0x2B, 0xD1, 0xF4, 0xC3, 0x34, 0x6F, 0x2F, 0x83, 0xC2, 0xA6, 0x7C, 0x6F,
  210. 0x3D, 0x88, 0xA0, 0x58, 0x22, 0x1F, 0x3A, 0xBA, 0x7B, 0xC6, 0xDD, 0x66, 0xFE, 0xF8, 0x92, 0xE4,
  211. 0xCB, 0x1C, 0xC4, 0x19, 0x0A, 0x0C, 0x8B, 0x2E, 0x39, 0xB8, 0xB8, 0x03, 0xCD, 0x5A, 0x9E, 0x10,
  212. 0x3A, 0x4F, 0x65, 0xFA, 0x41, 0xCB, 0xF2, 0x79, 0x65, 0xD7, 0xF1, 0x9F, 0xAB, 0x70, 0x1D, 0x6F,
  213. 0xF7, 0xB6, 0x79, 0xCC, 0x8A, 0x7D, 0xCE, 0xDB, 0xF8, 0xF6, 0x9E, 0xC9, 0x12, 0x9F, 0xAA, 0xBF,
  214. 0x89, 0xFE, 0x05, 0x36, 0x80
  215. };
  216. auto stream = MUST(try_make<FixedMemoryStream>(compressed));
  217. auto decompressor = MUST(Compress::LzmaDecompressor::create_from_container(move(stream)));
  218. auto buffer_or_error = decompressor->read_until_eof(PAGE_SIZE);
  219. EXPECT(buffer_or_error.is_error());
  220. }