[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:
parent
b7fcd704e8
commit
e9030c9550
|
@ -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 */
|
/* allocate space for repeated fields, also check that all required fields have been set */
|
||||||
for (f = 0; f < desc->n_fields; f++) {
|
for (f = 0; f < desc->n_fields; f++) {
|
||||||
const ProtobufCFieldDescriptor *field = desc->fields + f;
|
const ProtobufCFieldDescriptor *field = desc->fields + f;
|
||||||
|
if (field == NULL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (field->label == PROTOBUF_C_LABEL_REPEATED) {
|
if (field->label == PROTOBUF_C_LABEL_REPEATED) {
|
||||||
size_t siz =
|
size_t siz =
|
||||||
sizeof_elt_in_repeated_array(field->type);
|
sizeof_elt_in_repeated_array(field->type);
|
||||||
|
|
Loading…
Reference in New Issue