Fixed a bug with field numbers >255 in a oneof.

The compiler should not assert-fail in this case, it should merely decline to emit a fast parser for that field.

PiperOrigin-RevId: 502919928
pull/13171/head
Joshua Haberman 2 years ago committed by Copybara-Service
parent e4232a1984
commit aa68739fa7
  1. 3
      upbc/protoc-gen-upb.cc

@ -1107,8 +1107,7 @@ bool TryFillTableEntry(const DefPoolPair& pools, upb::FieldDefPtr field,
}
if (field.real_containing_oneof()) {
uint64_t case_offset = ~mt_f->presence;
if (case_offset > 0xffff) return false;
assert(field.number() < 256);
if (case_offset > 0xffff || field.number() > 0xff) return false;
data |= field.number() << 24;
data |= case_offset << 32;
} else {

Loading…
Cancel
Save