xref: /llvm-project/compiler-rt/lib/gwp_asan/tests/compression.cpp (revision 5556616b5b5223f95607ad94053a55f0deaf2762)
1be8a2f75SMitch Phillips //===-- compression.cpp -----------------------------------------*- C++ -*-===//
2be8a2f75SMitch Phillips //
3be8a2f75SMitch Phillips // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4be8a2f75SMitch Phillips // See https://llvm.org/LICENSE.txt for license information.
5be8a2f75SMitch Phillips // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6be8a2f75SMitch Phillips //
7be8a2f75SMitch Phillips //===----------------------------------------------------------------------===//
8be8a2f75SMitch Phillips 
9be8a2f75SMitch Phillips #include "gwp_asan/stack_trace_compressor.h"
10*5556616bSKostya Kortchinsky #include "gwp_asan/tests/harness.h"
11be8a2f75SMitch Phillips 
12be8a2f75SMitch Phillips namespace gwp_asan {
13be8a2f75SMitch Phillips namespace compression {
14be8a2f75SMitch Phillips 
TEST(GwpAsanCompressionTest,SingleByteVarInt)15be8a2f75SMitch Phillips TEST(GwpAsanCompressionTest, SingleByteVarInt) {
16be8a2f75SMitch Phillips   uint8_t Compressed[1];
17be8a2f75SMitch Phillips 
18be8a2f75SMitch Phillips   uintptr_t Uncompressed = 0x00;
19be8a2f75SMitch Phillips   EXPECT_EQ(1u, pack(&Uncompressed, 1u, Compressed, sizeof(Compressed)));
20be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[0], 0x00);
21be8a2f75SMitch Phillips 
22be8a2f75SMitch Phillips   Uncompressed = 0x01;
23be8a2f75SMitch Phillips   EXPECT_EQ(1u, pack(&Uncompressed, 1u, Compressed, sizeof(Compressed)));
24be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[0], 0x02); // +1 => 2 in zigzag.
25be8a2f75SMitch Phillips 
26be8a2f75SMitch Phillips   Uncompressed = 0x3f;
27be8a2f75SMitch Phillips   EXPECT_EQ(1u, pack(&Uncompressed, 1u, Compressed, sizeof(Compressed)));
28be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[0], 0x7e); // +63 => 127 in zigzag.
29be8a2f75SMitch Phillips }
30be8a2f75SMitch Phillips 
TEST(GwpAsanCompressionTest,MultiByteVarInt)31be8a2f75SMitch Phillips TEST(GwpAsanCompressionTest, MultiByteVarInt) {
32be8a2f75SMitch Phillips   uint8_t Compressed[sizeof(uintptr_t) + 1];
33be8a2f75SMitch Phillips 
34be8a2f75SMitch Phillips   uintptr_t Uncompressed = 0x40;
35be8a2f75SMitch Phillips   EXPECT_EQ(2u, pack(&Uncompressed, 1u, Compressed, sizeof(Compressed)));
36be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[0], 0x80); // +64 => 128 in zigzag.
37be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[1], 0x01);
38be8a2f75SMitch Phillips 
39be8a2f75SMitch Phillips   Uncompressed = 0x41;
40be8a2f75SMitch Phillips   EXPECT_EQ(2u, pack(&Uncompressed, 1u, Compressed, sizeof(Compressed)));
41be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[0], 0x82); // +65 => 130 in zigzag
42be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[1], 0x01);
43be8a2f75SMitch Phillips 
44be8a2f75SMitch Phillips   Uncompressed = 0x1fff;
45be8a2f75SMitch Phillips   EXPECT_EQ(2u, pack(&Uncompressed, 1u, Compressed, sizeof(Compressed)));
46be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[0], 0xfe); // +8191 => 16382 in zigzag
47be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[1], 0x7f);
48be8a2f75SMitch Phillips 
49be8a2f75SMitch Phillips   Uncompressed = 0x2000;
50be8a2f75SMitch Phillips   EXPECT_EQ(3u, pack(&Uncompressed, 1u, Compressed, sizeof(Compressed)));
51be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[0], 0x80); // +8192 => 16384 in zigzag
52be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[1], 0x80);
53be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[2], 0x01);
54be8a2f75SMitch Phillips 
5526fd9568SMitch Phillips   Uncompressed = 0x7f010ff0;
56be8a2f75SMitch Phillips   EXPECT_EQ(5u, pack(&Uncompressed, 1u, Compressed, sizeof(Compressed)));
5726fd9568SMitch Phillips   EXPECT_EQ(Compressed[0], 0xe0); // +0x7f010ff0 => 0xFE021FE0 in zigzag
58be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[1], 0xbf);
59be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[2], 0x88);
60be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[3], 0xf0);
6126fd9568SMitch Phillips   EXPECT_EQ(Compressed[4], 0x0f);
62be8a2f75SMitch Phillips }
63be8a2f75SMitch Phillips 
TEST(GwpAsanCompressionTest,CorrectDifference)64be8a2f75SMitch Phillips TEST(GwpAsanCompressionTest, CorrectDifference) {
65be8a2f75SMitch Phillips   uint8_t Compressed[10];
66be8a2f75SMitch Phillips   uintptr_t Uncompressed[2] = {0x00, 0x00};
67be8a2f75SMitch Phillips 
68be8a2f75SMitch Phillips   EXPECT_EQ(2u, pack(Uncompressed, sizeof(Uncompressed) / sizeof(uintptr_t),
69be8a2f75SMitch Phillips                      Compressed, sizeof(Compressed)));
70be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[1], 0x00); // +0 difference => 0 in zigzag.
71be8a2f75SMitch Phillips 
72be8a2f75SMitch Phillips   Uncompressed[1] = 0x01;
73be8a2f75SMitch Phillips   EXPECT_EQ(2u, pack(Uncompressed, sizeof(Uncompressed) / sizeof(uintptr_t),
74be8a2f75SMitch Phillips                      Compressed, sizeof(Compressed)));
75be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[1], 0x02); // +1 difference => 2 in zigzag.
76be8a2f75SMitch Phillips 
77be8a2f75SMitch Phillips   Uncompressed[1] = 0x02;
78be8a2f75SMitch Phillips   EXPECT_EQ(2u, pack(Uncompressed, sizeof(Uncompressed) / sizeof(uintptr_t),
79be8a2f75SMitch Phillips                      Compressed, sizeof(Compressed)));
80be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[1], 0x04); // +2 difference => 4 in zigzag.
81be8a2f75SMitch Phillips 
82be8a2f75SMitch Phillips   Uncompressed[1] = 0x80;
83be8a2f75SMitch Phillips   EXPECT_EQ(3u, pack(Uncompressed, sizeof(Uncompressed) / sizeof(uintptr_t),
84be8a2f75SMitch Phillips                      Compressed, sizeof(Compressed)));
85be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[1], 0x80); // +128 difference => +256 in zigzag (note the
86be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[2], 0x02); // varint encoding here).
87be8a2f75SMitch Phillips 
88be8a2f75SMitch Phillips   Uncompressed[0] = 0x01;
89be8a2f75SMitch Phillips   Uncompressed[1] = 0x00;
90be8a2f75SMitch Phillips   EXPECT_EQ(2u, pack(Uncompressed, sizeof(Uncompressed) / sizeof(uintptr_t),
91be8a2f75SMitch Phillips                      Compressed, sizeof(Compressed)));
92be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[1], 0x01); // -1 difference => +1 in zigzag.
93be8a2f75SMitch Phillips 
94be8a2f75SMitch Phillips   Uncompressed[0] = 0x02;
95be8a2f75SMitch Phillips   EXPECT_EQ(2u, pack(Uncompressed, sizeof(Uncompressed) / sizeof(uintptr_t),
96be8a2f75SMitch Phillips                      Compressed, sizeof(Compressed)));
97be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[1], 0x03); // -2 difference => +3 in zigzag.
98be8a2f75SMitch Phillips 
99be8a2f75SMitch Phillips   Uncompressed[0] = 0x80;
100be8a2f75SMitch Phillips   EXPECT_EQ(4u, pack(Uncompressed, sizeof(Uncompressed) / sizeof(uintptr_t),
101be8a2f75SMitch Phillips                      Compressed, sizeof(Compressed)));
102be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[2], 0xff); // -128 difference => +255 in zigzag (note the
103be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[3], 0x01); // varint encoding here).
104be8a2f75SMitch Phillips }
105be8a2f75SMitch Phillips 
106be8a2f75SMitch Phillips // Space needed to encode the biggest uintptr_t as a varint is ceil((8 / 7) *
107be8a2f75SMitch Phillips // sizeof(uintptr_t)), as each 7 bits requires 8 bits of space.
108be8a2f75SMitch Phillips constexpr size_t kBytesForLargestVarInt = (sizeof(uintptr_t) * 8) / 7 + 1;
109be8a2f75SMitch Phillips 
110be8a2f75SMitch Phillips // Ensures that when the closest diff between two pointers is via. underflow,
111be8a2f75SMitch Phillips // we take the underflow option.
TEST(GwpAsanCompressionTest,ClosestDiffIsUnderflow)112be8a2f75SMitch Phillips TEST(GwpAsanCompressionTest, ClosestDiffIsUnderflow) {
113be8a2f75SMitch Phillips   uint8_t Compressed[2];
114be8a2f75SMitch Phillips   uintptr_t Uncompressed[2] = {0x00, UINTPTR_MAX};
115be8a2f75SMitch Phillips 
116be8a2f75SMitch Phillips   EXPECT_EQ(2u, pack(Uncompressed, sizeof(Uncompressed) / sizeof(uintptr_t),
117be8a2f75SMitch Phillips                      Compressed, sizeof(Compressed)));
118be8a2f75SMitch Phillips   // -1 difference => +1 in zigzag.
119be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[1], 0x01);
120be8a2f75SMitch Phillips }
121be8a2f75SMitch Phillips 
122be8a2f75SMitch Phillips // Ensures that when the closest diff between two pointers is via. overflow,
123be8a2f75SMitch Phillips // that we take this option.
TEST(GwpAsanCompressionTest,ClosestDiffIsOverflow)124be8a2f75SMitch Phillips TEST(GwpAsanCompressionTest, ClosestDiffIsOverflow) {
125be8a2f75SMitch Phillips   uint8_t Compressed[2];
126be8a2f75SMitch Phillips   uintptr_t Uncompressed[2] = {UINTPTR_MAX, 0x00};
127be8a2f75SMitch Phillips 
128be8a2f75SMitch Phillips   // Note here that the first element is encoded as the difference from zero.
129be8a2f75SMitch Phillips   EXPECT_EQ(2u, pack(Uncompressed, sizeof(Uncompressed) / sizeof(uintptr_t),
130be8a2f75SMitch Phillips                      Compressed, sizeof(Compressed)));
131be8a2f75SMitch Phillips   // -1 difference => +1 in zigzag (the first pointer is encoded as -1).
132be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[0], 0x01);
133be8a2f75SMitch Phillips   // +1 difference => +2 in zigzag.
134be8a2f75SMitch Phillips   EXPECT_EQ(Compressed[1], 0x02);
135be8a2f75SMitch Phillips }
136be8a2f75SMitch Phillips 
runPackUnpack(uintptr_t * Test,size_t NumEntries)137be8a2f75SMitch Phillips void runPackUnpack(uintptr_t *Test, size_t NumEntries) {
138be8a2f75SMitch Phillips   // Setup the input/output buffers based on the maximum possible size.
139be8a2f75SMitch Phillips   uintptr_t *Uncompressed =
140be8a2f75SMitch Phillips       static_cast<uintptr_t *>(alloca(NumEntries * sizeof(uintptr_t)));
141be8a2f75SMitch Phillips   size_t CompressedBufferSize = NumEntries * kBytesForLargestVarInt;
142be8a2f75SMitch Phillips   uint8_t *Compressed = static_cast<uint8_t *>(alloca(CompressedBufferSize));
143be8a2f75SMitch Phillips 
144be8a2f75SMitch Phillips   // Pack the provided testcase, recoding the number of bytes it took for
145be8a2f75SMitch Phillips   // storage.
146be8a2f75SMitch Phillips   size_t BytesUsedForPacking =
147be8a2f75SMitch Phillips       pack(Test, NumEntries, Compressed, CompressedBufferSize);
148be8a2f75SMitch Phillips   EXPECT_NE(BytesUsedForPacking, 0u);
149be8a2f75SMitch Phillips 
150be8a2f75SMitch Phillips   // Unpack the testcase and ensure that the correct number of entries was
151be8a2f75SMitch Phillips   // unpacked.
152be8a2f75SMitch Phillips   EXPECT_EQ(NumEntries,
153be8a2f75SMitch Phillips             unpack(Compressed, BytesUsedForPacking, Uncompressed, NumEntries));
154be8a2f75SMitch Phillips 
155be8a2f75SMitch Phillips   // Ensure that the unpacked trace is the same as the original testcase.
156be8a2f75SMitch Phillips   for (size_t i = 0; i < NumEntries; ++i) {
157be8a2f75SMitch Phillips     EXPECT_EQ(Uncompressed[i], Test[i]);
158be8a2f75SMitch Phillips   }
159be8a2f75SMitch Phillips }
160be8a2f75SMitch Phillips 
TEST(GwpAsanCompressionTest,UncompressVarInt)161be8a2f75SMitch Phillips TEST(GwpAsanCompressionTest, UncompressVarInt) {
16226fd9568SMitch Phillips   uint8_t Compressed[] = {0x00, 0xaa, 0xaf, 0xd0, 0xda, 0x04};
163be8a2f75SMitch Phillips   uintptr_t Uncompressed[2];
164be8a2f75SMitch Phillips 
165be8a2f75SMitch Phillips   EXPECT_EQ(2u, unpack(Compressed, sizeof(Compressed), Uncompressed, 2u));
166be8a2f75SMitch Phillips   EXPECT_EQ(Uncompressed[0], 0x00u);
16726fd9568SMitch Phillips   EXPECT_EQ(Uncompressed[1], 0x25aa0bd5u);
16826fd9568SMitch Phillips }
16926fd9568SMitch Phillips 
TEST(GwpAsanCompressionTest,UncompressVarIntUnderflow)17026fd9568SMitch Phillips TEST(GwpAsanCompressionTest, UncompressVarIntUnderflow) {
17126fd9568SMitch Phillips   uint8_t Compressed[] = {0x00, 0xab, 0xaf, 0xd0, 0xda, 0x04};
17226fd9568SMitch Phillips   uintptr_t Uncompressed[2];
17326fd9568SMitch Phillips 
17426fd9568SMitch Phillips   EXPECT_EQ(2u, unpack(Compressed, sizeof(Compressed), Uncompressed, 2u));
17526fd9568SMitch Phillips   EXPECT_EQ(Uncompressed[0], 0x00u);
17626fd9568SMitch Phillips   EXPECT_EQ(Uncompressed[1], UINTPTR_MAX - 0x25aa0bd5u);
177be8a2f75SMitch Phillips }
178be8a2f75SMitch Phillips 
TEST(GwpAsanCompressionTest,CompressUncompressAscending)179be8a2f75SMitch Phillips TEST(GwpAsanCompressionTest, CompressUncompressAscending) {
180be8a2f75SMitch Phillips   uintptr_t Test[] = {1, 2, 3};
181be8a2f75SMitch Phillips   runPackUnpack(Test, sizeof(Test) / sizeof(uintptr_t));
182be8a2f75SMitch Phillips }
183be8a2f75SMitch Phillips 
TEST(GwpAsanCompressionTest,CompressUncompressDescending)184be8a2f75SMitch Phillips TEST(GwpAsanCompressionTest, CompressUncompressDescending) {
185be8a2f75SMitch Phillips   uintptr_t Test[] = {3, 2, 1};
186be8a2f75SMitch Phillips   runPackUnpack(Test, sizeof(Test) / sizeof(uintptr_t));
187be8a2f75SMitch Phillips }
188be8a2f75SMitch Phillips 
TEST(GwpAsanCompressionTest,CompressUncompressRepeated)189be8a2f75SMitch Phillips TEST(GwpAsanCompressionTest, CompressUncompressRepeated) {
190be8a2f75SMitch Phillips   uintptr_t Test[] = {3, 3, 3};
191be8a2f75SMitch Phillips   runPackUnpack(Test, sizeof(Test) / sizeof(uintptr_t));
192be8a2f75SMitch Phillips }
193be8a2f75SMitch Phillips 
TEST(GwpAsanCompressionTest,CompressUncompressZigZag)194be8a2f75SMitch Phillips TEST(GwpAsanCompressionTest, CompressUncompressZigZag) {
195be8a2f75SMitch Phillips   uintptr_t Test[] = {1, 3, 2, 4, 1, 2};
196be8a2f75SMitch Phillips   runPackUnpack(Test, sizeof(Test) / sizeof(uintptr_t));
197be8a2f75SMitch Phillips }
198be8a2f75SMitch Phillips 
TEST(GwpAsanCompressionTest,CompressUncompressVarInt)199be8a2f75SMitch Phillips TEST(GwpAsanCompressionTest, CompressUncompressVarInt) {
20026fd9568SMitch Phillips   uintptr_t Test[] = {0x1981561, 0x18560, 0x25ab9135, 0x1232562};
201be8a2f75SMitch Phillips   runPackUnpack(Test, sizeof(Test) / sizeof(uintptr_t));
202be8a2f75SMitch Phillips }
203be8a2f75SMitch Phillips 
TEST(GwpAsanCompressionTest,CompressUncompressLargestDifference)204be8a2f75SMitch Phillips TEST(GwpAsanCompressionTest, CompressUncompressLargestDifference) {
205be8a2f75SMitch Phillips   uintptr_t Test[] = {0x00, INTPTR_MAX, UINTPTR_MAX, INTPTR_MAX, 0x00};
206be8a2f75SMitch Phillips   runPackUnpack(Test, sizeof(Test) / sizeof(uintptr_t));
207be8a2f75SMitch Phillips }
208be8a2f75SMitch Phillips 
TEST(GwpAsanCompressionTest,CompressUncompressBigPointers)209be8a2f75SMitch Phillips TEST(GwpAsanCompressionTest, CompressUncompressBigPointers) {
210be8a2f75SMitch Phillips   uintptr_t Test[] = {UINTPTR_MAX, UINTPTR_MAX - 10};
211be8a2f75SMitch Phillips   runPackUnpack(Test, sizeof(Test) / sizeof(uintptr_t));
212be8a2f75SMitch Phillips 
213be8a2f75SMitch Phillips   uintptr_t Test2[] = {UINTPTR_MAX - 10, UINTPTR_MAX};
214be8a2f75SMitch Phillips   runPackUnpack(Test2, sizeof(Test2) / sizeof(uintptr_t));
215be8a2f75SMitch Phillips }
216be8a2f75SMitch Phillips 
TEST(GwpAsanCompressionTest,UncompressFailsWithOutOfBoundsVarInt)217be8a2f75SMitch Phillips TEST(GwpAsanCompressionTest, UncompressFailsWithOutOfBoundsVarInt) {
218be8a2f75SMitch Phillips   uint8_t Compressed[kBytesForLargestVarInt + 1];
219be8a2f75SMitch Phillips   for (size_t i = 0; i < kBytesForLargestVarInt; ++i) {
220be8a2f75SMitch Phillips     Compressed[i] = 0x80;
221be8a2f75SMitch Phillips   }
222be8a2f75SMitch Phillips   Compressed[kBytesForLargestVarInt] = 0x00;
223be8a2f75SMitch Phillips 
224be8a2f75SMitch Phillips   uintptr_t Uncompressed;
225be8a2f75SMitch Phillips   EXPECT_EQ(unpack(Compressed, kBytesForLargestVarInt + 1, &Uncompressed, 1),
226be8a2f75SMitch Phillips             0u);
227be8a2f75SMitch Phillips }
228be8a2f75SMitch Phillips 
TEST(GwpAsanCompressionTest,UncompressFailsWithTooSmallBuffer)229be8a2f75SMitch Phillips TEST(GwpAsanCompressionTest, UncompressFailsWithTooSmallBuffer) {
230be8a2f75SMitch Phillips   uint8_t Compressed[] = {0x80, 0x00};
231be8a2f75SMitch Phillips 
232be8a2f75SMitch Phillips   uintptr_t Uncompressed;
233be8a2f75SMitch Phillips   EXPECT_EQ(unpack(Compressed, 1u, &Uncompressed, 1), 0u);
234be8a2f75SMitch Phillips }
235be8a2f75SMitch Phillips 
TEST(GwpAsanCompressionTest,CompressPartiallySucceedsWithTooSmallBuffer)236be8a2f75SMitch Phillips TEST(GwpAsanCompressionTest, CompressPartiallySucceedsWithTooSmallBuffer) {
237be8a2f75SMitch Phillips   uintptr_t Uncompressed[] = {
238be8a2f75SMitch Phillips       0x80,  // Requires 2 bytes for varint.
239be8a2f75SMitch Phillips       0x100, // Requires two bytes for varint difference of 0x80.
240be8a2f75SMitch Phillips       0xff,  // Requires single byte for varint difference of -0x01
241be8a2f75SMitch Phillips   };
242be8a2f75SMitch Phillips   uint8_t Compressed[3 * kBytesForLargestVarInt];
243be8a2f75SMitch Phillips 
244be8a2f75SMitch Phillips   // Zero and one byte buffers shouldn't encode anything (see above for size
245be8a2f75SMitch Phillips   // requirements).
246be8a2f75SMitch Phillips   EXPECT_EQ(pack(Uncompressed, 3u, Compressed, 0u), 0u);
247be8a2f75SMitch Phillips   EXPECT_EQ(pack(Uncompressed, 3u, Compressed, 1u), 0u);
248be8a2f75SMitch Phillips 
249be8a2f75SMitch Phillips   // Two byte buffer should hold a single varint-encoded value.
250be8a2f75SMitch Phillips   EXPECT_EQ(pack(Uncompressed, 3u, Compressed, 2u), 2u);
251be8a2f75SMitch Phillips 
252be8a2f75SMitch Phillips   // Three bytes isn't enough to cover the first two pointers, as both take two
253be8a2f75SMitch Phillips   // bytes each to store. Expect a single value to be compressed.
254be8a2f75SMitch Phillips   EXPECT_EQ(pack(Uncompressed, 3u, Compressed, 3u), 2u);
255be8a2f75SMitch Phillips 
256be8a2f75SMitch Phillips   // Four bytes is enough for the first two pointers to be stored.
257be8a2f75SMitch Phillips   EXPECT_EQ(pack(Uncompressed, 3u, Compressed, 4u), 4u);
258be8a2f75SMitch Phillips 
259be8a2f75SMitch Phillips   // And five is enough for all three pointers to be stored.
260be8a2f75SMitch Phillips   EXPECT_EQ(pack(Uncompressed, 3u, Compressed, 5u), 5u);
261be8a2f75SMitch Phillips   // And a buffer that's bigger than five bytes should still only write five
262be8a2f75SMitch Phillips   // bytes.
263be8a2f75SMitch Phillips   EXPECT_EQ(pack(Uncompressed, 3u, Compressed, 6u), 5u);
264be8a2f75SMitch Phillips   EXPECT_EQ(pack(Uncompressed, 3u, Compressed, 3 * kBytesForLargestVarInt), 5u);
265be8a2f75SMitch Phillips }
266be8a2f75SMitch Phillips } // namespace compression
267be8a2f75SMitch Phillips } // namespace gwp_asan
268