[PATCH] Fix a clang analyzer 14 warning about a possible NULL deref.

[edmonds: Import commit from
bfc6249902.patch.]

Gbp-Pq: Name misc-2022-null-deref.patch
This commit is contained in:
Todd C. Miller 2022-06-29 11:18:16 -06:00 committed by zhouganqing
parent b7fcd704e8
commit e9030c9550
1 changed files with 3 additions and 0 deletions

View File

@ -3224,6 +3224,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);