Add correctness asserts to upb_addmsg

pull/13171/head
Anna R 5 years ago
parent 2a25fd557e
commit d2389ba261
  1. 4
      upb/decode.c

@ -249,6 +249,10 @@ static upb_msg *upb_addmsg(upb_decframe *frame,
upb_msg *submsg; upb_msg *submsg;
upb_array *arr = upb_getorcreatearr(frame, field); upb_array *arr = upb_getorcreatearr(frame, field);
UPB_ASSERT(field->label == UPB_LABEL_REPEATED);
UPB_ASSERT(field->descriptortype == UPB_DESCRIPTOR_TYPE_MESSAGE ||
field->descriptortype == UPB_DESCRIPTOR_TYPE_GROUP);
*subm = frame->layout->submsgs[field->submsg_index]; *subm = frame->layout->submsgs[field->submsg_index];
submsg = upb_msg_new(*subm, frame->state->arena); submsg = upb_msg_new(*subm, frame->state->arena);
CHK(submsg); CHK(submsg);

Loading…
Cancel
Save