From 6a49afa7fe83f38dd385bba57e3025f76bf485f2 Mon Sep 17 00:00:00 2001 From: Mats Kindahl Date: Wed, 3 Jul 2024 09:05:28 +0200 Subject: [PATCH] Fix string literal length for compressed_data_info The function `compressed_data_info` returns a record containing `name` but copies the data from string literal. Since `heap_form_tuple` expects a `name` value as source as well, it will copy too much data from the source, leading to ASAN complaining about copying outside the allocated range of data. The problem is fixed by using buffers of size `NAMEDATALEN` for each source string, ensuring that each of the string literals has sufficient data for being copied as names. --- .unreleased/pr_7187 | 1 + tsl/src/compression/compression.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 .unreleased/pr_7187 diff --git a/.unreleased/pr_7187 b/.unreleased/pr_7187 new file mode 100644 index 00000000000..93c1f0681f2 --- /dev/null +++ b/.unreleased/pr_7187 @@ -0,0 +1 @@ +Fixes: #7187 Fix string literal length for compressed_data_info diff --git a/tsl/src/compression/compression.c b/tsl/src/compression/compression.c index bef8545d974..4efafa13459 100644 --- a/tsl/src/compression/compression.c +++ b/tsl/src/compression/compression.c @@ -46,7 +46,7 @@ static const CompressionAlgorithmDefinition definitions[_END_COMPRESSION_ALGORIT [COMPRESSION_ALGORITHM_DELTADELTA] = DELTA_DELTA_ALGORITHM_DEFINITION, }; -static const char *compression_algorithm_name[] = { +static const char compression_algorithm_name[][NAMEDATALEN] = { [_INVALID_COMPRESSION_ALGORITHM] = "INVALID", [COMPRESSION_ALGORITHM_ARRAY] = "ARRAY", [COMPRESSION_ALGORITHM_DICTIONARY] = "DICTIONARY", [COMPRESSION_ALGORITHM_GORILLA] = "GORILLA", [COMPRESSION_ALGORITHM_DELTADELTA] = "DELTADELTA",