From ba93474aa223bdaf7cb524c002824096a4837146 Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Wed, 7 Mar 2018 21:07:14 +0000 Subject: Fix oneof encoding/decoding --- upb/decode.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'upb/decode.c') diff --git a/upb/decode.c b/upb/decode.c index a4da9a9..4340a90 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -269,7 +269,8 @@ static bool upb_decode_submsg(upb_decstate *d, const char *limit, const upb_msglayout_fieldinit_v1 *field, int group_number) { - char *submsg = *(void**)&frame->msg[field->offset]; + char *submsg_slot = upb_decode_prepareslot(d, frame, field); + char *submsg = *(void**)submsg_slot; const upb_msglayout_msginit_v1 *subm; UPB_ASSERT(field->submsg_index != UPB_NO_SUBMSG); @@ -281,7 +282,7 @@ static bool upb_decode_submsg(upb_decstate *d, CHK(submsg); submsg = upb_msg_init( submsg, (upb_msglayout*)subm, upb_arena_alloc(upb_env_arena(d->env))); - *(void**)&frame->msg[field->offset] = submsg; + *(void**)submsg_slot = submsg; } upb_decode_message(d, limit, group_number, submsg, subm); -- cgit v1.2.3