mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Merge branch '3929-gcc-12-static-analyzer-use-of-uninitialized-value-ctx-val-1-in-base32-c' into 'main'
Resolve "GCC 12 static analyzer: use of uninitialized value '*ctx.val[1]' in base32.c" Closes #3929 See merge request isc-projects/bind9!7655
This commit is contained in:
@@ -149,18 +149,6 @@ typedef struct {
|
||||
bool pad; /*%< Expect padding */
|
||||
} base32_decode_ctx_t;
|
||||
|
||||
static void
|
||||
base32_decode_init(base32_decode_ctx_t *ctx, int length, const char base[],
|
||||
bool pad, isc_buffer_t *target) {
|
||||
ctx->digits = 0;
|
||||
ctx->seen_end = false;
|
||||
ctx->seen_32 = 0;
|
||||
ctx->length = length;
|
||||
ctx->target = target;
|
||||
ctx->base = base;
|
||||
ctx->pad = pad;
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
base32_decode_char(base32_decode_ctx_t *ctx, int c) {
|
||||
const char *s;
|
||||
@@ -293,15 +281,15 @@ static isc_result_t
|
||||
base32_tobuffer(isc_lex_t *lexer, const char base[], bool pad,
|
||||
isc_buffer_t *target, int length) {
|
||||
unsigned int before, after;
|
||||
base32_decode_ctx_t ctx;
|
||||
base32_decode_ctx_t ctx = {
|
||||
.length = length, .base = base, .target = target, .pad = pad
|
||||
};
|
||||
isc_textregion_t *tr;
|
||||
isc_token_t token;
|
||||
bool eol;
|
||||
|
||||
REQUIRE(length >= -2);
|
||||
|
||||
base32_decode_init(&ctx, length, base, pad, target);
|
||||
|
||||
before = isc_buffer_usedlength(target);
|
||||
while (!ctx.seen_end && (ctx.length != 0)) {
|
||||
unsigned int i;
|
||||
@@ -350,9 +338,10 @@ isc_base32hexnp_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length) {
|
||||
static isc_result_t
|
||||
base32_decodestring(const char *cstr, const char base[], bool pad,
|
||||
isc_buffer_t *target) {
|
||||
base32_decode_ctx_t ctx;
|
||||
base32_decode_ctx_t ctx = {
|
||||
.length = -1, .base = base, .target = target, .pad = pad
|
||||
};
|
||||
|
||||
base32_decode_init(&ctx, -1, base, pad, target);
|
||||
for (;;) {
|
||||
int c = *cstr++;
|
||||
if (c == '\0') {
|
||||
@@ -385,9 +374,10 @@ isc_base32hexnp_decodestring(const char *cstr, isc_buffer_t *target) {
|
||||
static isc_result_t
|
||||
base32_decoderegion(isc_region_t *source, const char base[], bool pad,
|
||||
isc_buffer_t *target) {
|
||||
base32_decode_ctx_t ctx;
|
||||
base32_decode_ctx_t ctx = {
|
||||
.length = -1, .base = base, .target = target, .pad = pad
|
||||
};
|
||||
|
||||
base32_decode_init(&ctx, -1, base, pad, target);
|
||||
while (source->length != 0) {
|
||||
int c = *source->base;
|
||||
RETERR(base32_decode_char(&ctx, c));
|
||||
|
Reference in New Issue
Block a user