Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libyang for openSUSE:Factory checked in at 2026-12-04 15:25:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libyang (Old) and /work/SRC/openSUSE:Factory/.libyang.new.1340718 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libyang" Fri Dec 4 15:25:43 2026 rev:24 rq:1402983 version:3.13.6 Changes: -------- --- /work/SRC/openSUSE:Factory/libyang/libyang.changes 2026-10-27 16:48:23.884067920 +0100 +++ /work/SRC/openSUSE:Factory/.libyang.new.1340718/libyang.changes 2026-12-04 15:27:46.029661970 +0100 @@ -1,0 +2,12 @@ +Fri Nov 27 08:58:05 UTC 2026 - Petr Gajdos <[email protected]> + +- added patches + CVE-2026-136905: an incomplete cleanup vulnerability in ly_out_reset() in src/out.c [bsc#1291848] + * libyang-CVE-2026-136905.patch + CVE-2026-136907: a return of wrong status code vulnerability in ly_in_filepath() in src/in.c [bsc#1291851] + CVE-2026-136906: a file descriptor leak in ly_in_new_filepath() and ly_in_filepath() in src/in.c that fails to close descriptors when file mapping fails [bsc#1291850] + * libyang-CVE-2026-136907,136906.patch + CVE-2026-136908: a release of invalid pointer vulnerability in ly_in_memory() and ly_in_memory_chunk() in src/in.c [bsc#1291853] + * libyang-CVE-2026-136908.patch + +------------------------------------------------------------------- New: ---- libyang-CVE-2026-136905.patch libyang-CVE-2026-136907,136906.patch libyang-CVE-2026-136908.patch ----------(New B)---------- New: CVE-2026-136905: an incomplete cleanup vulnerability in ly_out_reset() in src/out.c [bsc#1291848] * libyang-CVE-2026-136905.patch CVE-2026-136907: a return of wrong status code vulnerability in ly_in_filepath() in src/in.c [bsc#1291851] New: CVE-2026-136906: a file descriptor leak in ly_in_new_filepath() and ly_in_filepath() in src/in.c that fails to close descriptors when file mapping fails [bsc#1291850] * libyang-CVE-2026-136907,136906.patch CVE-2026-136908: a release of invalid pointer vulnerability in ly_in_memory() and ly_in_memory_chunk() in src/in.c [bsc#1291853] New: CVE-2026-136908: a release of invalid pointer vulnerability in ly_in_memory() and ly_in_memory_chunk() in src/in.c [bsc#1291853] * libyang-CVE-2026-136908.patch ----------(New E)---------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libyang.spec ++++++ --- /var/tmp/diff_new_pack.5zqMbO/_old 2026-12-04 15:27:46.755692819 +0100 +++ /var/tmp/diff_new_pack.5zqMbO/_new 2026-12-04 15:27:46.757692904 +0100 @@ -33,6 +33,12 @@ Patch1: libyang-CVE-2026-44673.patch # CVE-2026-115327: an uninitialized pointer free vulnerability in lydxml_env_netconf_rpc() in src/parser_xml.c [bsc#1286830] Patch2: libyang-CVE-2026-115327.patch +# CVE-2026-136908: a release of invalid pointer vulnerability in ly_in_memory() and ly_in_memory_chunk() in src/in.c [bsc#1291853] +Patch3: libyang-CVE-2026-136908.patch +# CVE-2026-136905: an incomplete cleanup vulnerability in ly_out_reset() in src/out.c [bsc#1291848] +Patch4: libyang-CVE-2026-136905.patch +# CVE-2026-136907: a return of wrong status code vulnerability in ly_in_filepath() in src/in.c [bsc#1291851]|CVE-2026-136906: a file descriptor leak in ly_in_new_filepath() and ly_in_filepath() in src/in.c that fails to close descriptors when file mapping fails [bsc#1291850] +Patch5: libyang-CVE-2026-136907,136906.patch BuildRequires: cmake BuildRequires: doxygen BuildRequires: fdupes ++++++ libyang-CVE-2026-136905.patch ++++++ >From 98a4d748f5b744cc9011bb8ade972d69167ed17e Mon Sep 17 00:00:00 2001 From: Pu Cheng <[email protected]> Date: Fri, 20 Nov 2026 05:49:41 +0800 Subject: [PATCH] out BUGFIX truncate in ly_out_reset() based on the seek result Whether to truncate the file was decided by errno != ESPIPE also after a successful lseek()/fseek(), which does not change errno. With errno left at ESPIPE from before (for example by ly_out_reset() of an output writing to a pipe), the file was rewound but not truncated and the tail of the previous output remained after the new one. --- src/out.c | 22 ++++++++++++---------- tests/utests/basic/test_inout.c | 6 ++++++ 2 files changed, 18 insertions(+), 10 deletions(-) Index: libyang-3.13.6/src/out.c =================================================================== --- libyang-3.13.6.orig/src/out.c +++ libyang-3.13.6/src/out.c @@ -305,11 +305,12 @@ ly_out_reset(struct ly_out *out) LOGINT(NULL); return LY_EINT; case LY_OUT_FD: - if ((lseek(out->method.fd, 0, SEEK_SET) == -1) && (errno != ESPIPE)) { - LOGERR(NULL, LY_ESYS, "Seeking output file descriptor failed (%s).", strerror(errno)); - return LY_ESYS; - } - if ((errno != ESPIPE) && (ftruncate(out->method.fd, 0) == -1)) { + if (lseek(out->method.fd, 0, SEEK_SET) == -1) { + if (errno != ESPIPE) { + LOGERR(NULL, LY_ESYS, "Seeking output file descriptor failed (%s).", strerror(errno)); + return LY_ESYS; + } + } else if (ftruncate(out->method.fd, 0) == -1) { LOGERR(NULL, LY_ESYS, "Truncating output file failed (%s).", strerror(errno)); return LY_ESYS; } @@ -317,11 +318,12 @@ ly_out_reset(struct ly_out *out) case LY_OUT_FDSTREAM: case LY_OUT_FILE: case LY_OUT_FILEPATH: - if ((fseek(out->method.f, 0, SEEK_SET) == -1) && (errno != ESPIPE)) { - LOGERR(NULL, LY_ESYS, "Seeking output file stream failed (%s).", strerror(errno)); - return LY_ESYS; - } - if ((errno != ESPIPE) && (ftruncate(fileno(out->method.f), 0) == -1)) { + if (fseek(out->method.f, 0, SEEK_SET) == -1) { + if (errno != ESPIPE) { + LOGERR(NULL, LY_ESYS, "Seeking output file stream failed (%s).", strerror(errno)); + return LY_ESYS; + } + } else if (ftruncate(fileno(out->method.f), 0) == -1) { LOGERR(NULL, LY_ESYS, "Truncating output file failed (%s).", strerror(errno)); return LY_ESYS; } Index: libyang-3.13.6/tests/utests/basic/test_inout.c =================================================================== --- libyang-3.13.6.orig/tests/utests/basic/test_inout.c +++ libyang-3.13.6/tests/utests/basic/test_inout.c @@ -248,6 +248,8 @@ test_output_fd(void **UNUSED(state)) assert_int_equal(10, read(fd2, buf, 30)); assert_string_equal("test print", buf); assert_int_equal(0, lseek(fd2, 0, SEEK_SET)); + /* a value of errno left from before must not prevent truncating */ + errno = ESPIPE; assert_int_equal(LY_SUCCESS, ly_out_reset(out)); assert_int_equal(LY_SUCCESS, ly_write(out, "rewrite", 8)); @@ -292,6 +294,8 @@ test_output_file(void **UNUSED(state)) assert_non_null(fgets(buf, 31, f2)); assert_string_equal("test print", buf); assert_int_equal(0, fseek(f2, 0, SEEK_SET)); + /* a value of errno left from before must not prevent truncating */ + errno = ESPIPE; assert_int_equal(LY_SUCCESS, ly_out_reset(out)); assert_int_equal(LY_SUCCESS, ly_write(out, "rewrite", 8)); @@ -299,6 +303,8 @@ test_output_file(void **UNUSED(state)) ly_print_flush(out); assert_non_null(fgets(buf, 31, f2)); assert_string_equal("rewrite", buf); + assert_int_equal(0, fseek(f2, 0, SEEK_END)); + assert_int_equal(8, ftell(f2)); fclose(f2); ly_out_free(out, NULL, 1); ++++++ libyang-CVE-2026-136907,136906.patch ++++++ >From ed9b84f325fb88e1aa467417222c5f0d0ab51fb0 Mon Sep 17 00:00:00 2001 From: Michal Vasko <[email protected]> Date: Thu, 29 Oct 2026 14:59:58 +0100 Subject: [PATCH] in BUGFIX proper return values Fixes #2598 --- src/in.c | 7 ++++--- tests/utests/basic/test_inout.c | 9 +++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) Index: libyang-3.13.6/src/in.c =================================================================== --- libyang-3.13.6.orig/src/in.c +++ libyang-3.13.6/src/in.c @@ -204,7 +204,7 @@ ly_in_new_filepath(const char *filepath, LY_CHECK_ERR_RET(fd == -1, LOGERR(NULL, LY_ESYS, "Failed to open file \"%s\" (%s).", fp, strerror(errno)); free(fp), LY_ESYS); - LY_CHECK_ERR_RET(ret = ly_in_new_fd(fd, in), free(fp), ret); + LY_CHECK_ERR_RET(ret = ly_in_new_fd(fd, in), close(fd); free(fp), ret); /* convert the LY_IN_FD input handler into the LY_IN_FILE */ (*in)->type = LY_IN_FILEPATH; @@ -234,12 +234,13 @@ ly_in_filepath(struct ly_in *in, const c /* replace filepath */ fd = open(fp, O_RDONLY); - LY_CHECK_ERR_RET(!fd, LOGERR(NULL, LY_ESYS, "Failed to open file \"%s\" (%s).", fp, strerror(errno)); free(fp), NULL); + LY_CHECK_ERR_RET(fd == -1, LOGERR(NULL, LY_ESYS, "Failed to open file \"%s\" (%s).", fp, strerror(errno)); free(fp), + ((void *)-1)); /* convert LY_IN_FILEPATH handler into LY_IN_FD to be able to update it via ly_in_fd() */ in->type = LY_IN_FD; prev_fd = ly_in_fd(in, fd); - LY_CHECK_ERR_RET(prev_fd == -1, in->type = LY_IN_FILEPATH; free(fp), NULL); + LY_CHECK_ERR_RET(prev_fd == -1, in->type = LY_IN_FILEPATH; close(fd); free(fp), ((void *)-1)); /* and convert the result back */ in->type = LY_IN_FILEPATH; Index: libyang-3.13.6/tests/utests/basic/test_inout.c =================================================================== --- libyang-3.13.6.orig/tests/utests/basic/test_inout.c +++ libyang-3.13.6/tests/utests/basic/test_inout.c @@ -180,6 +180,15 @@ test_input_filepath(void **UNUSED(state) assert_int_equal(LY_IN_FILEPATH, ly_in_type(in)); assert_ptr_equal(NULL, ly_in_filepath(in, path2, 0)); assert_string_equal(path2, ly_in_filepath(in, NULL, 0)); + + /* a file that cannot be opened or mapped is an error and the handler keeps its file */ + assert_ptr_equal(((void *)-1), ly_in_filepath(in, TESTS_BIN "/no_such_dir/libyang_test_input", 0)); + CHECK_LOG_LASTMSG("Failed to open file \"" TESTS_BIN "/no_such_dir/libyang_test_input\" (No such file or directory)."); + assert_string_equal(path2, ly_in_filepath(in, NULL, 0)); + assert_ptr_equal(((void *)-1), ly_in_filepath(in, TEST_OUTPUT_FILE, 0)); + CHECK_LOG_LASTMSG("Empty input file."); + assert_string_equal(path2, ly_in_filepath(in, NULL, 0)); + ly_in_free(in, 0); } ++++++ libyang-CVE-2026-136908.patch ++++++ >From 76c8009e63e52a5557cfafd68fbe44c22d732c74 Mon Sep 17 00:00:00 2001 From: Pu Cheng <[email protected]> Date: Fri, 20 Nov 2026 05:49:41 +0800 Subject: [PATCH] in BUGFIX return the previous start address when changing memory input ly_in_memory() and ly_in_memory_chunk() are documented to return the previous starting address, which the caller is responsible to free, but they returned the current read position. After some data were read or parsed, the returned pointer pointed inside the previous data and freeing it was an invalid free. --- src/in.c | 4 ++-- tests/utests/basic/test_inout.c | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) Index: libyang-3.13.6/src/in.c =================================================================== --- libyang-3.13.6.orig/src/in.c +++ libyang-3.13.6/src/in.c @@ -175,7 +175,7 @@ ly_in_memory(struct ly_in *in, const cha LY_CHECK_ARG_RET(NULL, in, in->type == LY_IN_MEMORY, NULL); - data = in->current; + data = in->start; if (str) { in->start = in->current = str; Index: libyang-3.13.6/tests/utests/basic/test_inout.c =================================================================== --- libyang-3.13.6.orig/tests/utests/basic/test_inout.c +++ libyang-3.13.6/tests/utests/basic/test_inout.c @@ -81,7 +81,8 @@ static void test_input_mem(void **UNUSED(state)) { struct ly_in *in = NULL; - char *str1 = "a", *str2 = "b"; + char *str1 = "a", *str2 = "b", *str3 = "abc"; + char buf[2]; assert_int_equal(LY_EINVAL, ly_in_new_memory(NULL, NULL)); CHECK_LOG_LASTMSG("Invalid argument str (ly_in_new_memory())."); @@ -96,6 +97,12 @@ test_input_mem(void **UNUSED(state)) assert_ptr_equal(str2, ly_in_memory(in, NULL)); assert_ptr_equal(str2, ly_in_memory(in, NULL)); ly_in_free(in, 0); + + /* the previous start address is returned also after some data were read */ + assert_int_equal(LY_SUCCESS, ly_in_new_memory(str3, &in)); + assert_int_equal(LY_SUCCESS, ly_in_read(in, buf, 2)); + assert_ptr_equal(str3, ly_in_memory(in, str1)); + ly_in_free(in, 0); } static void
