From 3d7e4d6347c3524109373472c29a51e931c0ba0c Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Wed, 24 Jan 2024 06:05:20 +0000 Subject: [PATCH] Auto-generate files after cl/601004095 --- php/ext/google/protobuf/php-upb.c | 3 ++- ruby/ext/google/protobuf_c/ruby-upb.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/php/ext/google/protobuf/php-upb.c b/php/ext/google/protobuf/php-upb.c index 2be3f96cb2..113ddd29c3 100644 --- a/php/ext/google/protobuf/php-upb.c +++ b/php/ext/google/protobuf/php-upb.c @@ -5289,6 +5289,7 @@ static bool _upb_mapsorter_resize(_upb_mapsorter* s, _upb_sortedmap* sorted, bool _upb_mapsorter_pushmap(_upb_mapsorter* s, upb_FieldType key_type, const upb_Map* map, _upb_sortedmap* sorted) { int map_size = _upb_Map_Size(map); + UPB_ASSERT(map_size); if (!_upb_mapsorter_resize(s, sorted, map_size)) return false; @@ -8841,7 +8842,7 @@ static void encode_map(upb_encstate* e, const upb_Message* msg, upb_MiniTableSub_Message(subs[f->UPB_PRIVATE(submsg_index)]); UPB_ASSERT(layout->UPB_PRIVATE(field_count) == 2); - if (map == NULL) return; + if (!map || !upb_Map_Size(map)) return; if (e->options & kUpb_EncodeOption_Deterministic) { _upb_sortedmap sorted; diff --git a/ruby/ext/google/protobuf_c/ruby-upb.c b/ruby/ext/google/protobuf_c/ruby-upb.c index 0bb82ae789..01b3f53da2 100644 --- a/ruby/ext/google/protobuf_c/ruby-upb.c +++ b/ruby/ext/google/protobuf_c/ruby-upb.c @@ -4803,6 +4803,7 @@ static bool _upb_mapsorter_resize(_upb_mapsorter* s, _upb_sortedmap* sorted, bool _upb_mapsorter_pushmap(_upb_mapsorter* s, upb_FieldType key_type, const upb_Map* map, _upb_sortedmap* sorted) { int map_size = _upb_Map_Size(map); + UPB_ASSERT(map_size); if (!_upb_mapsorter_resize(s, sorted, map_size)) return false; @@ -8355,7 +8356,7 @@ static void encode_map(upb_encstate* e, const upb_Message* msg, upb_MiniTableSub_Message(subs[f->UPB_PRIVATE(submsg_index)]); UPB_ASSERT(layout->UPB_PRIVATE(field_count) == 2); - if (map == NULL) return; + if (!map || !upb_Map_Size(map)) return; if (e->options & kUpb_EncodeOption_Deterministic) { _upb_sortedmap sorted;