From 335edb909f2f0922843b112fec229d3684e0c435 Mon Sep 17 00:00:00 2001 From: Hong Shin Date: Tue, 23 Apr 2024 08:17:38 -0700 Subject: [PATCH] update decode_fast.c to assert that non-const messages are not frozen PiperOrigin-RevId: 627393634 --- upb/wire/internal/decode_fast.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/upb/wire/internal/decode_fast.c b/upb/wire/internal/decode_fast.c index 67be4135c4..726f65ad24 100644 --- a/upb/wire/internal/decode_fast.c +++ b/upb/wire/internal/decode_fast.c @@ -231,6 +231,7 @@ UPB_FORCEINLINE void* fastdecode_getfield(upb_Decoder* d, const char* ptr, upb_Message* msg, uint64_t* data, uint64_t* hasbits, fastdecode_arr* farr, int valbytes, upb_card card) { + UPB_ASSERT(!upb_Message_IsFrozen(msg)); switch (card) { case CARD_s: { uint8_t hasbit_index = *data >> 24; @@ -606,6 +607,7 @@ UPB_NOINLINE static const char* fastdecode_verifyutf8(upb_Decoder* d, const char* ptr, upb_Message* msg, intptr_t table, uint64_t hasbits, uint64_t data) { + UPB_ASSERT(!upb_Message_IsFrozen(msg)); upb_StringView* dst = (upb_StringView*)data; if (!_upb_Decoder_VerifyUtf8Inline(dst->data, dst->size)) { _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_BadUtf8); @@ -651,6 +653,7 @@ UPB_NOINLINE static const char* fastdecode_longstring_noutf8( struct upb_Decoder* d, const char* ptr, upb_Message* msg, intptr_t table, uint64_t hasbits, uint64_t data) { + UPB_ASSERT(!upb_Message_IsFrozen(msg)); upb_StringView* dst = (upb_StringView*)data; FASTDECODE_LONGSTRING(d, ptr, msg, table, hasbits, dst, false); }