Fix big endian handling of enums

Previously using an enum for a field on big-endian process such as the
s390x would fail to decode properly. We need to munge it in the correct
byte order before decoding it.
pull/13171/head
Stan Hu 3 years ago
parent da350f6aae
commit c604ed9ae9
No known key found for this signature in database
GPG Key ID: 8D3931AD39CC7A20
  1. 1
      upb/decode.c

@ -282,6 +282,7 @@ static void decode_munge(int type, wireval *val) {
}
case UPB_DESCRIPTOR_TYPE_INT32:
case UPB_DESCRIPTOR_TYPE_UINT32:
case UPB_DESCRIPTOR_TYPE_ENUM:
if (!_upb_isle()) {
/* The next stage will memcpy(dst, &val, 4) */
val->uint32_val = val->uint64_val;

Loading…
Cancel
Save