MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / TEST

Function TEST

src/Compression/tests/gtest_compressionCodec.cpp:1329–1357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1327//);
1328
1329TEST(LZ4Test, DecompressMalformedInput)
1330{
1331 /// This malformed input was initially found by lz4_decompress_fuzzer and causes failure under UBSAN.
1332 constexpr unsigned char data[]
1333 = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1334 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1335 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1336 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1337 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1338 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1339 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1340 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00,
1341 0x00, 0x20, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0xff, 0xff, 0xff, 0x17, 0xff, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
1342 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
1343 0xfe, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
1344
1345 const char * const source = reinterpret_cast<const char * const>(data);
1346 const uint32_t source_size = std::size(data);
1347 constexpr uint32_t uncompressed_size = 80;
1348
1349 DB::Memory<> memory;
1350 memory.resize(ICompressionCodec::getHeaderSize() + uncompressed_size + LZ4::ADDITIONAL_BYTES_AT_END_OF_BUFFER);
1351 unalignedStoreLittleEndian<uint8_t>(memory.data(), static_cast<uint8_t>(CompressionMethodByte::LZ4));
1352 unalignedStoreLittleEndian<uint32_t>(&memory[1], source_size);
1353 unalignedStoreLittleEndian<uint32_t>(&memory[5], uncompressed_size);
1354
1355 auto codec = CompressionCodecFactory::instance().get("LZ4", {});
1356 ASSERT_THROW(codec->decompress(source, source_size, memory.data()), Exception);
1357}
1358
1359TEST(DoubleDeltaTest, TranscodeRawInput)
1360{

Callers

nothing calls this directly

Calls 10

makeCodecFunction · 0.85
sizeFunction · 0.50
resizeMethod · 0.45
dataMethod · 0.45
getMethod · 0.45
decompressMethod · 0.45
compressMethod · 0.45
sizeMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected