From 4f280b3bb1789f64b96a631c88c3591fa19b124a Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Mon, 12 Dec 2022 12:21:15 -0800 Subject: [PATCH] Updated release branch to latest upb. (#11258) * Updated release branch to latest upb. * Updated amalgamated files. --- php/ext/google/protobuf/php-upb.c | 5 ++--- protobuf_deps.bzl | 4 ++-- ruby/ext/google/protobuf_c/ruby-upb.c | 5 ++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/php/ext/google/protobuf/php-upb.c b/php/ext/google/protobuf/php-upb.c index 602509a64a4a..7ccb94614317 100644 --- a/php/ext/google/protobuf/php-upb.c +++ b/php/ext/google/protobuf/php-upb.c @@ -6143,7 +6143,6 @@ upb_EnumReservedRange* _upb_EnumReservedRanges_New( google_protobuf_EnumDescriptorProto_EnumReservedRange_start(protos[i]); const int32_t end = google_protobuf_EnumDescriptorProto_EnumReservedRange_end(protos[i]); - const int32_t max = kUpb_MaxFieldNumber + 1; // A full validation would also check that each range is disjoint, and that // none of the fields overlap with the extension ranges, but we are just @@ -6151,7 +6150,7 @@ upb_EnumReservedRange* _upb_EnumReservedRanges_New( // Note: Not a typo! Unlike extension ranges and message reserved ranges, // the end value of an enum reserved range is *inclusive*! - if (start < 1 || end < start || end > max) { + if (end < start) { symtab_errf(ctx, "Reserved range (%d, %d) is invalid, enum=%s\n", (int)start, (int)end, upb_EnumDef_FullName(e)); } @@ -8184,7 +8183,7 @@ static void create_fielddef( CHK_OOM( upb_strtable_insert(&oneof->ntof, name.data, name.size, v, ctx->arena)); } else { - if (f->proto3_optional_) { + if (f->proto3_optional_ && !is_extension) { symtab_errf(ctx, "field with proto3_optional was not in a oneof (%s)", f->full_name); } diff --git a/protobuf_deps.bzl b/protobuf_deps.bzl index 6aee8b76dd5b..0949ef370a07 100644 --- a/protobuf_deps.bzl +++ b/protobuf_deps.bzl @@ -117,6 +117,6 @@ def protobuf_deps(): _github_archive( name = "upb", repo = "https://github.com/protocolbuffers/upb", - commit = "969f6fdb88e94ced87953e53716893c68ec7b1ce", - sha256 = "6754b7f95c92f69a832a82931aea40d066cc689dbc1eb3348b84c1ed95285296", + commit = "20b542a767139732548f7b8cf28c4c928cdcb07b", + sha256 = "c77158955326f9e9a0cf8481c118b8ad5c34df99e5db3af27f3d1662d8bedef7", ) diff --git a/ruby/ext/google/protobuf_c/ruby-upb.c b/ruby/ext/google/protobuf_c/ruby-upb.c index 85b1d0f2ffe2..3d3c35be9318 100755 --- a/ruby/ext/google/protobuf_c/ruby-upb.c +++ b/ruby/ext/google/protobuf_c/ruby-upb.c @@ -5814,7 +5814,6 @@ upb_EnumReservedRange* _upb_EnumReservedRanges_New( google_protobuf_EnumDescriptorProto_EnumReservedRange_start(protos[i]); const int32_t end = google_protobuf_EnumDescriptorProto_EnumReservedRange_end(protos[i]); - const int32_t max = kUpb_MaxFieldNumber + 1; // A full validation would also check that each range is disjoint, and that // none of the fields overlap with the extension ranges, but we are just @@ -5822,7 +5821,7 @@ upb_EnumReservedRange* _upb_EnumReservedRanges_New( // Note: Not a typo! Unlike extension ranges and message reserved ranges, // the end value of an enum reserved range is *inclusive*! - if (start < 1 || end < start || end > max) { + if (end < start) { symtab_errf(ctx, "Reserved range (%d, %d) is invalid, enum=%s\n", (int)start, (int)end, upb_EnumDef_FullName(e)); } @@ -7855,7 +7854,7 @@ static void create_fielddef( CHK_OOM( upb_strtable_insert(&oneof->ntof, name.data, name.size, v, ctx->arena)); } else { - if (f->proto3_optional_) { + if (f->proto3_optional_ && !is_extension) { symtab_errf(ctx, "field with proto3_optional was not in a oneof (%s)", f->full_name); }