From e9f400dd3700546f2488f652ae666cda56be7ea8 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Sat, 31 Jan 2026 23:22:30 +0100 Subject: [PATCH] base32_decode: avoid shifting into the sign bit While this won't do harm on systems that do 2's completement, it triggers the compilers' undefined-behavior sanitizer and fixes sanitizer error such as the one below (where the 1694... will vary) and is distracting while debugging. dnssec.c:1427:12: runtime error: left shift of 1694604366 by 1 places cannot be represented in type 'int' --- src/dnssec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dnssec.c b/src/dnssec.c index c9cbacd..952084c 100644 --- a/src/dnssec.c +++ b/src/dnssec.c @@ -1423,7 +1423,10 @@ static int base32_decode(char *in, unsigned char *out) oc |= 1; mask = mask >> 1; if (((++on) & 7) == 0) - *p++ = oc; + { + *p++ = oc; + oc = 0; + } oc = oc << 1; } }