From 7878682b8e4f1f1fb564531e6ec7ee9d7347d380 Mon Sep 17 00:00:00 2001 From: Clayton Knittel Date: Thu, 23 Jan 2025 13:44:07 -0800 Subject: [PATCH] Add debug check for field not being extension in `HasBitIndex()`. PiperOrigin-RevId: 718998148 --- src/google/protobuf/generated_message_reflection.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/google/protobuf/generated_message_reflection.h b/src/google/protobuf/generated_message_reflection.h index d83c795e44ef4..84ce8232ceda6 100644 --- a/src/google/protobuf/generated_message_reflection.h +++ b/src/google/protobuf/generated_message_reflection.h @@ -156,6 +156,7 @@ struct ReflectionSchema { // Bit index within the bit array of hasbits. Bit order is low-to-high. uint32_t HasBitIndex(const FieldDescriptor* field) const { + ABSL_DCHECK(!field->is_extension()); if (has_bits_offset_ == -1) return static_cast(-1); ABSL_DCHECK(HasHasbits()); return has_bit_indices_[field->index()];