Skip to content

Commit

Permalink
Fix string literal length for compressed_data_info
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mkindahl committed Aug 7, 2024
1 parent f38c6f0 commit 6a49afa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions .unreleased/pr_7187
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixes: #7187 Fix string literal length for compressed_data_info
2 changes: 1 addition & 1 deletion tsl/src/compression/compression.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 6a49afa

Please sign in to comment.