diff --git a/php/ext/google/protobuf/php-upb.c b/php/ext/google/protobuf/php-upb.c index 9c880a6240..7b7806928e 100644 --- a/php/ext/google/protobuf/php-upb.c +++ b/php/ext/google/protobuf/php-upb.c @@ -12021,6 +12021,7 @@ const double kUpb_NaN = NAN; bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need, upb_Arena* a) { + UPB_ASSERT(!upb_Message_IsFrozen(msg)); const size_t overhead = sizeof(upb_Message_Internal); upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); @@ -15423,6 +15424,7 @@ upb_MessageValue upb_Message_GetFieldByDef(const upb_Message* msg, upb_MutableMessageValue upb_Message_Mutable(upb_Message* msg, const upb_FieldDef* f, upb_Arena* a) { + UPB_ASSERT(!upb_Message_IsFrozen(msg)); UPB_ASSERT(upb_FieldDef_IsSubMessage(f) || upb_FieldDef_IsRepeated(f)); if (upb_FieldDef_HasPresence(f) && !upb_Message_HasFieldByDef(msg, f)) { // We need to skip the upb_Message_GetFieldByDef() call in this case. @@ -15461,6 +15463,7 @@ make: bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f, upb_MessageValue val, upb_Arena* a) { + UPB_ASSERT(!upb_Message_IsFrozen(msg)); const upb_MiniTableField* m_f = upb_FieldDef_MiniTable(f); if (upb_MiniTableField_IsExtension(m_f)) { @@ -15473,6 +15476,7 @@ bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f, } void upb_Message_ClearFieldByDef(upb_Message* msg, const upb_FieldDef* f) { + UPB_ASSERT(!upb_Message_IsFrozen(msg)); const upb_MiniTableField* m_f = upb_FieldDef_MiniTable(f); if (upb_MiniTableField_IsExtension(m_f)) { @@ -15483,6 +15487,7 @@ void upb_Message_ClearFieldByDef(upb_Message* msg, const upb_FieldDef* f) { } void upb_Message_ClearByDef(upb_Message* msg, const upb_MessageDef* m) { + UPB_ASSERT(!upb_Message_IsFrozen(msg)); upb_Message_Clear(msg, upb_MessageDef_MiniTable(m)); } @@ -15544,6 +15549,7 @@ bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m, bool _upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, int depth) { + UPB_ASSERT(!upb_Message_IsFrozen(msg)); size_t iter = kUpb_Message_Begin; const upb_FieldDef* f; upb_MessageValue val; diff --git a/ruby/ext/google/protobuf_c/ruby-upb.c b/ruby/ext/google/protobuf_c/ruby-upb.c index 4caee9dc69..d90b3eea1d 100644 --- a/ruby/ext/google/protobuf_c/ruby-upb.c +++ b/ruby/ext/google/protobuf_c/ruby-upb.c @@ -11514,6 +11514,7 @@ const double kUpb_NaN = NAN; bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need, upb_Arena* a) { + UPB_ASSERT(!upb_Message_IsFrozen(msg)); const size_t overhead = sizeof(upb_Message_Internal); upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); @@ -14916,6 +14917,7 @@ upb_MessageValue upb_Message_GetFieldByDef(const upb_Message* msg, upb_MutableMessageValue upb_Message_Mutable(upb_Message* msg, const upb_FieldDef* f, upb_Arena* a) { + UPB_ASSERT(!upb_Message_IsFrozen(msg)); UPB_ASSERT(upb_FieldDef_IsSubMessage(f) || upb_FieldDef_IsRepeated(f)); if (upb_FieldDef_HasPresence(f) && !upb_Message_HasFieldByDef(msg, f)) { // We need to skip the upb_Message_GetFieldByDef() call in this case. @@ -14954,6 +14956,7 @@ make: bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f, upb_MessageValue val, upb_Arena* a) { + UPB_ASSERT(!upb_Message_IsFrozen(msg)); const upb_MiniTableField* m_f = upb_FieldDef_MiniTable(f); if (upb_MiniTableField_IsExtension(m_f)) { @@ -14966,6 +14969,7 @@ bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f, } void upb_Message_ClearFieldByDef(upb_Message* msg, const upb_FieldDef* f) { + UPB_ASSERT(!upb_Message_IsFrozen(msg)); const upb_MiniTableField* m_f = upb_FieldDef_MiniTable(f); if (upb_MiniTableField_IsExtension(m_f)) { @@ -14976,6 +14980,7 @@ void upb_Message_ClearFieldByDef(upb_Message* msg, const upb_FieldDef* f) { } void upb_Message_ClearByDef(upb_Message* msg, const upb_MessageDef* m) { + UPB_ASSERT(!upb_Message_IsFrozen(msg)); upb_Message_Clear(msg, upb_MessageDef_MiniTable(m)); } @@ -15037,6 +15042,7 @@ bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m, bool _upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, int depth) { + UPB_ASSERT(!upb_Message_IsFrozen(msg)); size_t iter = kUpb_Message_Begin; const upb_FieldDef* f; upb_MessageValue val;