From fce33eaeb9a2aa6a5d5193d9ba318962ed7912ea Mon Sep 17 00:00:00 2001 From: mengwenhua Date: Sat, 7 Jan 2023 15:40:30 +0800 Subject: [PATCH] Fix a clang analyzer 14 warning about a possible NULL deref. Signed-off-by: mengwenhua --- ...yzer-14-warning-about-a-possible-NUL.patch | 28 +++++++++++++++++++ protobuf-c.spec | 6 +++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 backport-0001-Fix-a-clang-analyzer-14-warning-about-a-possible-NUL.patch diff --git a/backport-0001-Fix-a-clang-analyzer-14-warning-about-a-possible-NUL.patch b/backport-0001-Fix-a-clang-analyzer-14-warning-about-a-possible-NUL.patch new file mode 100644 index 0000000..453fe56 --- /dev/null +++ b/backport-0001-Fix-a-clang-analyzer-14-warning-about-a-possible-NUL.patch @@ -0,0 +1,28 @@ +From ab5f76a52bade28a2c025bd52c7847f033ca82f3 Mon Sep 17 00:00:00 2001 +From: "Todd C. Miller" +Date: Wed, 29 Jun 2022 11:18:16 -0600 +Subject: [PATCH] Fix a clang analyzer 14 warning about a possible NULL deref. + +[edmonds: Import commit from +https://github.com/sudo-project/sudo/commit/bfc6249902d842626058e74074832930feaf2f80.patch.] +--- + protobuf-c/protobuf-c.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/protobuf-c/protobuf-c.c b/protobuf-c/protobuf-c.c +index 448f3e8..ad3ab12 100644 +--- a/protobuf-c/protobuf-c.c ++++ b/protobuf-c/protobuf-c.c +@@ -3231,6 +3231,9 @@ protobuf_c_message_unpack(const ProtobufCMessageDescriptor *desc, + /* allocate space for repeated fields, also check that all required fields have been set */ + for (f = 0; f < desc->n_fields; f++) { + const ProtobufCFieldDescriptor *field = desc->fields + f; ++ if (field == NULL) { ++ continue; ++ } + if (field->label == PROTOBUF_C_LABEL_REPEATED) { + size_t siz = + sizeof_elt_in_repeated_array(field->type); +-- +2.37.3.windows.1 + diff --git a/protobuf-c.spec b/protobuf-c.spec index e46e3f3..bea5bc4 100644 --- a/protobuf-c.spec +++ b/protobuf-c.spec @@ -1,6 +1,6 @@ Name: protobuf-c Version: 1.4.0 -Release: 3 +Release: 4 Summary: This is protobuf-c, a C implementation of the Google Protocol Buffers data serialization format License: BSD URL: https://github.com/protobuf-c/protobuf-c @@ -13,6 +13,7 @@ Obsoletes: %{name}-compiler < %{version}-%{release} Patch6000: backport-0001-Fix-issue-499-unsigned-integer-overflow.patch Patch6001: backport-0002-Fix-regression-with-zero-length-messages-introduced-.patch +Patch6002: backport-0001-Fix-a-clang-analyzer-14-warning-about-a-possible-NUL.patch %description This is protobuf-c, a C implementation of the Google Protocol Buffers data serialization format. @@ -53,6 +54,9 @@ make check %{_libdir}/{libprotobuf-c.so,pkgconfig/libprotobuf-c.pc} %changelog +* Sat Jan 7 2023 mengwenhua - 1.4.0-4 +- Fix a clang analyzer 14 warning about a possible NULL deref. + * Sat Jan 7 2023 mengwenhua - 1.4.0-3 - Type:bugfix - CVE:NA -- Gitee