Skip to content

Commit

Permalink
Merge branch '3.17.x' into fixDuplicateClassErrors
Browse files Browse the repository at this point in the history
  • Loading branch information
deannagarcia authored May 25, 2021
2 parents be5b994 + e635605 commit 771fa8b
Show file tree
Hide file tree
Showing 43 changed files with 105 additions and 70 deletions.
16 changes: 2 additions & 14 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
Protocol Compiler
* Stop emitting boilerplate {Copy/Merge}From in each ProtoBuf class
* split the accessor annotations according to their operation
* introduce proto message injector
* let proto message injector decide whether to calculate address info based on field descriptor and access type.
* Disable LITE_RUNTIME injector annotations
* move callback and @protoc_insertion_point after internal set of enum fields
* Improve ExtractFieldInfo codegen for string fields with oneof or default value
* Rename MessageInjector to FieldAccessListener
* Change the API of FieldAccessListener to support callbacks for info extraction
* make field_access_injector private

2021-05-07 version 3.17.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
PHP
* Fixed PHP memory leaks and arginfo errors. (#8614)
* Fixed JSON parser to allow multiple values from the same oneof as long as
all but one are null.

Ruby
* Fixed memory bug: properly root repeated/map field when assigning. (#8639)
* Fixed JSON parser to allow multiple values from the same oneof as long as
all but one are null.


2021-05-07 version 3.17.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)

Protocol Compiler
Expand Down
2 changes: 1 addition & 1 deletion Protobuf-C++.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Protobuf-C++'
s.version = '3.17.0'
s.version = '3.17.1'
s.summary = 'Protocol Buffers v3 runtime library for C++.'
s.homepage = 'https://github.com/google/protobuf'
s.license = '3-Clause BSD License'
Expand Down
2 changes: 1 addition & 1 deletion Protobuf.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# dependent projects use the :git notation to refer to the library.
Pod::Spec.new do |s|
s.name = 'Protobuf'
s.version = '3.17.0'
s.version = '3.17.1'
s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.'
s.homepage = 'https://github.com/protocolbuffers/protobuf'
s.license = '3-Clause BSD License'
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ AC_PREREQ(2.59)
# In the SVN trunk, the version should always be the next anticipated release
# version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed
# the size of one file name in the dist tarfile over the 99-char limit.)
AC_INIT([Protocol Buffers],[3.17.0],[[email protected]],[protobuf])
AC_INIT([Protocol Buffers],[3.17.1],[[email protected]],[protobuf])

AM_MAINTAINER_MODE([enable])

Expand Down
2 changes: 1 addition & 1 deletion csharp/Google.Protobuf.Tools.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<title>Google Protocol Buffers tools</title>
<summary>Tools for Protocol Buffers - Google's data interchange format.</summary>
<description>See project site for more info.</description>
<version>3.17.0</version>
<version>3.17.1</version>
<authors>Google Inc.</authors>
<owners>protobuf-packages</owners>
<licenseUrl>https://github.com/protocolbuffers/protobuf/blob/master/LICENSE</licenseUrl>
Expand Down
2 changes: 1 addition & 1 deletion csharp/src/Google.Protobuf/Google.Protobuf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Description>C# runtime library for Protocol Buffers - Google's data interchange format.</Description>
<Copyright>Copyright 2015, Google Inc.</Copyright>
<AssemblyTitle>Google Protocol Buffers</AssemblyTitle>
<VersionPrefix>3.17.0</VersionPrefix>
<VersionPrefix>3.17.1</VersionPrefix>
<!-- C# 7.2 is required for Span/BufferWriter/ReadOnlySequence -->
<LangVersion>7.2</LangVersion>
<Authors>Google Inc.</Authors>
Expand Down
2 changes: 1 addition & 1 deletion java/bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-bom</artifactId>
<version>3.17.0</version>
<version>3.17.1</version>
<packaging>pom</packaging>

<name>Protocol Buffers [BOM]</name>
Expand Down
2 changes: 1 addition & 1 deletion java/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.17.0</version>
<version>3.17.1</version>
</parent>

<artifactId>protobuf-java</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion java/kotlin-lite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.17.0</version>
<version>3.17.1</version>
</parent>

<artifactId>protobuf-kotlin-lite</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion java/kotlin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.17.0</version>
<version>3.17.1</version>
</parent>

<artifactId>protobuf-kotlin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion java/lite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.17.0</version>
<version>3.17.1</version>
</parent>

<artifactId>protobuf-javalite</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.17.0</version>
<version>3.17.1</version>
<packaging>pom</packaging>

<name>Protocol Buffers [Parent]</name>
Expand Down
2 changes: 1 addition & 1 deletion java/util/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.17.0</version>
<version>3.17.1</version>
</parent>

<artifactId>protobuf-java-util</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "google-protobuf",
"version": "3.17.0",
"version": "3.17.1",
"description": "Protocol Buffers for JavaScript",
"main": "google-protobuf.js",
"files": [
Expand Down
30 changes: 25 additions & 5 deletions php/ext/google/protobuf/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@
<email>[email protected]</email>
<active>yes</active>
</lead>
<date>2021-05-11</date>
<time>13:29:14</time>
<date>2021-05-19</date>
<time>16:06:12</time>
<version>
<release>3.17.0</release>
<api>3.17.0</api>
<release>3.17.1</release>
<api>3.17.1</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
<notes>
No new changes in 3.17.0
* Fixed PHP memory leaks and arginfo errors. (#8614)
* Fixed JSON parser to allow multiple values from the same oneof as long as
all but one are null.
</notes>
<contents>
<dir baseinstalldir="/" name="/">
Expand Down Expand Up @@ -992,5 +994,23 @@ G A release.
<notes>
</notes>
</release>
<release>
<version>
<release>3.17.1</release>
<api>3.17.1</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2021-05-19</date>
<time>16:06:12</time>
<license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
<notes>
* Fixed PHP memory leaks and arginfo errors. (#8614)
* Fixed JSON parser to allow multiple values from the same oneof as long as
all but one are null.
</notes>
</release>
</changelog>
</package>
2 changes: 1 addition & 1 deletion php/ext/google/protobuf/protobuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_setter, 0, 0, 1)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()

#define PHP_PROTOBUF_VERSION "3.17.0"
#define PHP_PROTOBUF_VERSION "3.17.1"

// ptr -> PHP object cache. This is a weak map that caches lazily-created
// wrapper objects around upb types:
Expand Down
2 changes: 1 addition & 1 deletion protoc-artifacts/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protoc</artifactId>
<version>3.17.0</version>
<version>3.17.1</version>
<packaging>pom</packaging>
<name>Protobuf Compiler</name>
<description>
Expand Down
2 changes: 1 addition & 1 deletion python/google/protobuf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@

# Copyright 2007 Google Inc. All Rights Reserved.

__version__ = '3.17.0'
__version__ = '3.17.1'
8 changes: 5 additions & 3 deletions ruby/ext/google/protobuf_c/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ VALUE Map_deep_copy(VALUE obj) {
new_arena_rb);
}

const upb_map* Map_GetUpbMap(VALUE val, const upb_fielddef *field) {
const upb_map* Map_GetUpbMap(VALUE val, const upb_fielddef* field,
upb_arena* arena) {
const upb_fielddef* key_field = map_field_key(field);
const upb_fielddef* value_field = map_field_value(field);
TypeInfo value_type_info = TypeInfo_get(value_field);
Expand All @@ -189,6 +190,7 @@ const upb_map* Map_GetUpbMap(VALUE val, const upb_fielddef *field) {
rb_raise(cTypeError, "Map value type has wrong message/enum class");
}

Arena_fuse(self->arena, arena);
return self->map;
}

Expand Down Expand Up @@ -236,7 +238,7 @@ static VALUE Map_merge_into_self(VALUE _self, VALUE hashmap) {
upb_msg *self_msg = Map_GetMutable(_self);
size_t iter = UPB_MAP_BEGIN;

upb_arena_fuse(arena, Arena_get(other->arena));
Arena_fuse(other->arena, arena);

if (self->key_type != other->key_type ||
self->value_type_info.type != other->value_type_info.type ||
Expand Down Expand Up @@ -511,7 +513,7 @@ static VALUE Map_dup(VALUE _self) {
upb_arena *arena = Arena_get(new_self->arena);
upb_map *new_map = Map_GetMutable(new_map_rb);

upb_arena_fuse(arena, Arena_get(self->arena));
Arena_fuse(self->arena, arena);

while (upb_mapiter_next(self->map, &iter)) {
upb_msgval key = upb_mapiter_key(self->map, iter);
Expand Down
3 changes: 2 additions & 1 deletion ruby/ext/google/protobuf_c/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ VALUE Map_GetRubyWrapper(upb_map *map, upb_fieldtype_t key_type,
// Gets the underlying upb_map for this Ruby map object, which must have
// key/value type that match |field|. If this is not a map or the type doesn't
// match, raises an exception.
const upb_map *Map_GetUpbMap(VALUE val, const upb_fielddef *field);
const upb_map *Map_GetUpbMap(VALUE val, const upb_fielddef *field,
upb_arena *arena);

// Implements #inspect for this map by appending its contents to |b|.
void Map_Inspect(StringBuilder *b, const upb_map *map, upb_fieldtype_t key_type,
Expand Down
8 changes: 4 additions & 4 deletions ruby/ext/google/protobuf_c/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,9 @@ static void Message_setfield(upb_msg* msg, const upb_fielddef* f, VALUE val,
upb_arena* arena) {
upb_msgval msgval;
if (upb_fielddef_ismap(f)) {
msgval.map_val = Map_GetUpbMap(val, f);
msgval.map_val = Map_GetUpbMap(val, f, arena);
} else if (upb_fielddef_isseq(f)) {
msgval.array_val = RepeatedField_GetUpbArray(val, f);
msgval.array_val = RepeatedField_GetUpbArray(val, f, arena);
} else {
if (val == Qnil &&
(upb_fielddef_issubmsg(f) || upb_fielddef_realcontainingoneof(f))) {
Expand Down Expand Up @@ -660,7 +660,7 @@ static VALUE Message_dup(VALUE _self) {
// TODO(copy unknown fields?)
// TODO(use official upb msg copy function)
memcpy((upb_msg*)new_msg_self->msg, self->msg, size);
upb_arena_fuse(Arena_get(new_msg_self->arena), Arena_get(self->arena));
Arena_fuse(self->arena, Arena_get(new_msg_self->arena));
return new_msg;
}

Expand Down Expand Up @@ -1314,7 +1314,7 @@ const upb_msg* Message_GetUpbMessage(VALUE value, const upb_msgdef* m,
}

Message* self = ruby_to_Message(value);
upb_arena_fuse(arena, Arena_get(self->arena));
Arena_fuse(self->arena, arena);

return self->msg;
}
Expand Down
10 changes: 10 additions & 0 deletions ruby/ext/google/protobuf_c/protobuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,16 @@ upb_arena *Arena_get(VALUE _arena) {
return arena->arena;
}

void Arena_fuse(VALUE _arena, upb_arena *other) {
Arena *arena;
TypedData_Get_Struct(_arena, Arena, &Arena_type, arena);
if (!upb_arena_fuse(arena->arena, other)) {
rb_raise(rb_eRuntimeError,
"Unable to fuse arenas. This should never happen since Ruby does "
"not use initial blocks");
}
}

VALUE Arena_new() {
return Arena_alloc(cArena);
}
Expand Down
4 changes: 4 additions & 0 deletions ruby/ext/google/protobuf_c/protobuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ const upb_fielddef* map_field_value(const upb_fielddef* field);
VALUE Arena_new();
upb_arena *Arena_get(VALUE arena);

// Fuses this arena to another, throwing a Ruby exception if this is not
// possible.
void Arena_fuse(VALUE arena, upb_arena *other);

// Pins this Ruby object to the lifetime of this arena, so that as long as the
// arena is alive this object will not be collected.
//
Expand Down
6 changes: 4 additions & 2 deletions ruby/ext/google/protobuf_c/repeated_field.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ VALUE RepeatedField_deep_copy(VALUE _self) {
return new_rptfield;
}

const upb_array* RepeatedField_GetUpbArray(VALUE val, const upb_fielddef *field) {
const upb_array* RepeatedField_GetUpbArray(VALUE val, const upb_fielddef* field,
upb_arena* arena) {
RepeatedField* self;
TypeInfo type_info = TypeInfo_get(field);

Expand All @@ -167,6 +168,7 @@ const upb_array* RepeatedField_GetUpbArray(VALUE val, const upb_fielddef *field)
rb_raise(cTypeError, "Repeated field array has wrong message/enum class");
}

Arena_fuse(self->arena, arena);
return self->array;
}

Expand Down Expand Up @@ -412,7 +414,7 @@ static VALUE RepeatedField_dup(VALUE _self) {
int size = upb_array_size(self->array);
int i;

upb_arena_fuse(arena, Arena_get(self->arena));
Arena_fuse(self->arena, arena);

for (i = 0; i < size; i++) {
upb_msgval msgval = upb_array_get(self->array, i);
Expand Down
3 changes: 2 additions & 1 deletion ruby/ext/google/protobuf_c/repeated_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ VALUE RepeatedField_GetRubyWrapper(upb_array* msg, TypeInfo type_info,
// Gets the underlying upb_array for this Ruby RepeatedField object, which must
// have a type that matches |f|. If this is not a repeated field or the type
// doesn't match, raises an exception.
const upb_array* RepeatedField_GetUpbArray(VALUE value, const upb_fielddef* f);
const upb_array* RepeatedField_GetUpbArray(VALUE value, const upb_fielddef* f,
upb_arena* arena);

// Implements #inspect for this repeated field by appending its contents to |b|.
void RepeatedField_Inspect(StringBuilder* b, const upb_array* array,
Expand Down
2 changes: 1 addition & 1 deletion ruby/google-protobuf.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "google-protobuf"
s.version = "3.17.0"
s.version = "3.17.1"
git_tag = "v#{s.version.to_s.sub('.rc.', '-rc')}" # Converts X.Y.Z.rc.N to vX.Y.Z-rcN, used for the git tag
s.licenses = ["BSD-3-Clause"]
s.summary = "Protocol Buffers"
Expand Down
7 changes: 7 additions & 0 deletions ruby/tests/basic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ def test_issue_8311_crash
end
end

def test_issue_8559_crash
msg = TestMessage.new
msg.repeated_int32 = ::Google::Protobuf::RepeatedField.new(:int32, [1, 2, 3])
GC.start(full_mark: true, immediate_sweep: true)
TestMessage.encode(msg)
end

def test_has_field
m = TestSingularFields.new
assert !m.has_singular_msg?
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ else
PTHREAD_DEF =
endif

PROTOBUF_VERSION = 28:0:0
PROTOBUF_VERSION = 28:1:0

if GCC
# Turn on all warnings except for sign comparison (we ignore sign comparison
Expand Down
2 changes: 1 addition & 1 deletion src/google/protobuf/any.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 771fa8b

Please sign in to comment.