mirror of
https://github.com/protobuf-c/protobuf-c.git
synced 2025-01-14 01:07:57 +08:00
Fix a SEGV on on protobuf_c_check on messages with oneofs inside
Signed-off-by: Hayri Ugur Koltuk <ugur.koltuk@adyen.com>
This commit is contained in:
parent
269771b4b4
commit
5d043e544f
@ -3414,6 +3414,13 @@ protobuf_c_message_check(const ProtobufCMessage *message)
|
||||
ProtobufCType type = f->type;
|
||||
ProtobufCLabel label = f->label;
|
||||
void *field = STRUCT_MEMBER_P (message, f->offset);
|
||||
|
||||
if (f->flags & PROTOBUF_C_FIELD_FLAG_ONEOF) {
|
||||
const uint32_t *oneof_case = STRUCT_MEMBER_P (message, f->quantifier_offset);
|
||||
if (f->id != *oneof_case) {
|
||||
continue; //Do not check if it is an unpopulated oneof member.
|
||||
}
|
||||
}
|
||||
|
||||
if (label == PROTOBUF_C_LABEL_REPEATED) {
|
||||
size_t *quantity = STRUCT_MEMBER_P (message, f->quantifier_offset);
|
||||
|
Loading…
x
Reference in New Issue
Block a user