From aa789944630fa908cabf08754d38635c11dcfab1 Mon Sep 17 00:00:00 2001 From: Thales Antunes de Oliveira Barretto Date: Sun, 9 Mar 2025 16:08:49 -0300 Subject: [PATCH 1/2] [1/2]Fixes char to unsigned char for byte representation The forcing of signed char type was introduced by 3fb3bb5d38r, "configure: force 'char' type to be signed (#4025)". Thus at xlators/cluster/afr/src/afr-inode-write.c was found the use of a char type to represent bytes, when it should be using an unsigned type to avoid sign extension and overflow. This commit changes the variable "byte" to "unsigned" type. Signed-off-by: Thales Antunes de Oliveira Barretto # xlators/cluster/afr/src/afr-inode-write.c | 2 +- # 1 file changed, 1 insertion(+), 1 deletion(-) # xlators/cluster/afr/src/afr-inode-write.c | 2 +- # 1 file changed, 1 insertion(+), 1 deletion(-) # xlators/cluster/afr/src/afr-inode-write.c | 2 +- # 1 file changed, 1 insertion(+), 1 deletion(-) --- xlators/cluster/afr/src/afr-inode-write.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c index 6d3a8d38411..d7faa7bce11 100644 --- a/xlators/cluster/afr/src/afr-inode-write.c +++ b/xlators/cluster/afr/src/afr-inode-write.c @@ -381,7 +381,7 @@ afr_arbiter_writev_wind(call_frame_t *frame, xlator_t *this, int subvol) { afr_local_t *local = frame->local; afr_private_t *priv = this->private; - static char byte = 0xFF; + static unsigned char byte = 0xFF; static struct iovec vector = {&byte, 1}; int32_t count = 1; From 48792643bd3431f178873cdf918c09554fbcefd7 Mon Sep 17 00:00:00 2001 From: Thales Antunes de Oliveira Barretto Date: Sun, 9 Mar 2025 16:15:28 -0300 Subject: [PATCH 2/2] [2/2]Fixes char to unsigned char for byte representation The forcing of signed char type was introduced by 3fb3bb5d38r, "configure: force 'char' type to be signed (#4025)". Thus at xlators/features/compress/src/cdc-helper.c was found the use of a char type to represent bytes, when it should be using an unsigned type to avoid sign extension and overflow. This commit changes the variable "gzip_header" to "unsigned" type. Signed-off-by: Thales Antunes de Oliveira Barretto # xlators/features/compress/src/cdc-helper.c | 4 ++-- # 1 file changed, 2 insertions(+), 2 deletions(-) # xlators/features/compress/src/cdc-helper.c | 4 ++-- # 1 file changed, 2 insertions(+), 2 deletions(-) # xlators/features/compress/src/cdc-helper.c | 4 ++-- # 1 file changed, 2 insertions(+), 2 deletions(-) --- xlators/features/compress/src/cdc-helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xlators/features/compress/src/cdc-helper.c b/xlators/features/compress/src/cdc-helper.c index fef0fbd402a..0f9d806b191 100644 --- a/xlators/features/compress/src/cdc-helper.c +++ b/xlators/features/compress/src/cdc-helper.c @@ -30,8 +30,8 @@ * gzip_header is added only during debugging. * Refer to the function cdc_dump_iovec_to_disk */ -static const char gzip_header[10] = {'\037', '\213', Z_DEFLATED, 0, 0, 0, 0, - 0, 0, GF_CDC_OS_ID}; +static const unsigned char gzip_header[10] = { + '\037', '\213', Z_DEFLATED, 0, 0, 0, 0, 0, 0, GF_CDC_OS_ID}; static int32_t cdc_next_iovec(cdc_info_t *ci)