From 99ff12361d97097ce87026924c191e9cbb48d651 Mon Sep 17 00:00:00 2001 From: SESA741771 Date: Wed, 23 Apr 2025 13:24:05 +0200 Subject: [PATCH 1/5] src/parser_yin.c: coverity fix - missing varargs init or cleanup --- src/parser_yin.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/parser_yin.c b/src/parser_yin.c index a280423d8..fb10e1784 100644 --- a/src/parser_yin.c +++ b/src/parser_yin.c @@ -396,6 +396,7 @@ subelems_allocator(struct lysp_yin_ctx *ctx, size_t count, struct lysp_node *par return LY_SUCCESS; mem_err: + va_end(ap); subelems_deallocator(count, *result); LOGMEM(ctx->xmlctx->ctx); return LY_EMEM; From c78511ce292cdf1f0ab6c495e7b1947f03f75022 Mon Sep 17 00:00:00 2001 From: SESA741771 Date: Wed, 23 Apr 2025 13:42:16 +0200 Subject: [PATCH 2/5] src/ly_common.c: coverity fix - missing varargs init or cleanup --- src/ly_common.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ly_common.c b/src/ly_common.c index 449c862f9..ac62677ef 100644 --- a/src/ly_common.c +++ b/src/ly_common.c @@ -325,6 +325,7 @@ ly_utf8_and_equal(const char *input, int bytes, ...) /* compare each byte */ if (((uint8_t)input[i] & and) != (uint8_t)byte) { + va_end(ap); return 0; } } @@ -355,8 +356,10 @@ ly_utf8_less(const char *input, int bytes, ...) /* compare until bytes differ */ if ((uint8_t)input[i] > (uint8_t)byte) { + va_end(ap); return 0; } else if ((uint8_t)input[i] < (uint8_t)byte) { + va_end(ap); return 1; } } @@ -388,8 +391,10 @@ ly_utf8_greater(const char *input, int bytes, ...) /* compare until bytes differ */ if ((uint8_t)input[i] > (uint8_t)byte) { + va_end(ap); return 1; } else if ((uint8_t)input[i] < (uint8_t)byte) { + va_end(ap); return 0; } } From 5c9ca23aa1ef72b0fb893b2caebdd833a17e3ed4 Mon Sep 17 00:00:00 2001 From: SESA741771 Date: Mon, 7 Jul 2025 14:17:34 +0200 Subject: [PATCH 3/5] src/parser_lyb.c: coverity fix - dereference after null check --- src/parser_lyb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/parser_lyb.c b/src/parser_lyb.c index 342a02dd0..66ac68663 100644 --- a/src/parser_lyb.c +++ b/src/parser_lyb.c @@ -773,6 +773,7 @@ lyb_parse_schema_hash(struct lyd_lyb_ctx *lybctx, const struct lysc_node *sparen LOGERR(lybctx->lybctx->ctx, LY_EINT, "Failed to find matching hash for a top-level node from \"%s\".", mod->name); } else { + assert(sparent); LOGERR(lybctx->lybctx->ctx, LY_EINT, "Failed to find matching hash for a child node of \"%s\".", sparent->name); } From 3f62456f1722561352baa4435f9eca383cd3ccda Mon Sep 17 00:00:00 2001 From: SESA741771 Date: Mon, 7 Jul 2025 14:19:17 +0200 Subject: [PATCH 4/5] src/xpath.c: coverity fix - overflowed constant --- src/xpath.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/xpath.c b/src/xpath.c index 6b1a3c64e..99a4a2278 100644 --- a/src/xpath.c +++ b/src/xpath.c @@ -8256,6 +8256,7 @@ eval_name_test_with_predicate(const struct lyxp_expr *exp, uint32_t *tok_idx, en if (set->used) { i = set->used; + assert(i); do { --i; if (set->val.scnodes[i].in_ctx > LYXP_SET_SCNODE_ATOM_NODE) { From 99f0c07f9854cac7c72994086a80aa9bcf774371 Mon Sep 17 00:00:00 2001 From: SESA741771 Date: Mon, 7 Jul 2025 14:31:59 +0200 Subject: [PATCH 5/5] src/schema_compile_node.c: coverity fix - overflowed constant --- src/schema_compile_node.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/schema_compile_node.c b/src/schema_compile_node.c index 15f36bb49..5498b208e 100644 --- a/src/schema_compile_node.c +++ b/src/schema_compile_node.c @@ -1229,6 +1229,7 @@ lys_compile_pattern_chblocks_xmlschema2perl(const struct ly_ctx *ctx, const char ++idx; } if ((perl_regex[idx2] == ']') && (!idx2 || (perl_regex[idx2 - 1] != '\\'))) { + assert(idx); --idx; } }