From 22d0e471ee76d065e535cea9880af29375895cc4 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 11 Dec 2024 16:18:03 -0500 Subject: Fix widening conversions after arithmetic Overflow isn't actually possible here, but this avoids the issue statically in a way that won't trigger analysis tools. --- src/base64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base64.c b/src/base64.c index ce8af162..b12db9ff 100644 --- a/src/base64.c +++ b/src/base64.c @@ -91,7 +91,7 @@ decode_chunk(const uint8_t in[4], uint8_t out[3]) out[0] = (uint8_t)(((unmap(in[0]) << 2)) | unmap(in[1]) >> 4); out[1] = (uint8_t)(((unmap(in[1]) << 4) & 0xF0) | unmap(in[2]) >> 2); out[2] = (uint8_t)(((unmap(in[2]) << 6) & 0xC0) | unmap(in[3])); - return 1U + (in[2] != '=') + ((in[2] != '=') && (in[3] != '=')); + return (size_t)1U + (in[2] != '=') + ((in[2] != '=') && (in[3] != '=')); } void* -- cgit v1.2.1