google-protobuf 3.15.0-x64-mingw32 → 3.15.1-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of google-protobuf might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/ext/google/protobuf_c/message.c +33 -31
- data/lib/google/2.3/protobuf_c.so +0 -0
- data/lib/google/2.4/protobuf_c.so +0 -0
- data/lib/google/2.5/protobuf_c.so +0 -0
- data/lib/google/2.6/protobuf_c.so +0 -0
- data/lib/google/2.7/protobuf_c.so +0 -0
- data/lib/google/3.0/protobuf_c.so +0 -0
- data/tests/basic.rb +27 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e43eae6fbf8bd79611917473ede65b79914b5f957b76de496caa7615085bb082
|
4
|
+
data.tar.gz: 376b71fea8de29a7e540b0b85d0e29181bc3b2c076cefdf45a953fc97d08a95f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cff8d916b790ae4908454af4b7518789a19996235f49d20178ce594cef45bed68dec644381971305254be039a1fc2f46d61e4169f4136bfd2e3f913cf9a9d8f
|
7
|
+
data.tar.gz: abbf0c06efd8332182ef78d1a8542bd2ac40f31f9807377722ec30bf2d67672bddeae251de1bd570510ced7ac6870bc3a418b68b5b80a4a771fd826809bd1b17
|
@@ -292,6 +292,35 @@ static void Message_setfield(upb_msg* msg, const upb_fielddef* f, VALUE val,
|
|
292
292
|
upb_msg_set(msg, f, msgval, arena);
|
293
293
|
}
|
294
294
|
|
295
|
+
static VALUE Message_getfield(VALUE _self, const upb_fielddef* f) {
|
296
|
+
Message* self = ruby_to_Message(_self);
|
297
|
+
// This is a special-case: upb_msg_mutable() for map & array are logically
|
298
|
+
// const (they will not change what is serialized) but physically
|
299
|
+
// non-const, as they do allocate a repeated field or map. The logical
|
300
|
+
// constness means it's ok to do even if the message is frozen.
|
301
|
+
upb_msg *msg = (upb_msg*)self->msg;
|
302
|
+
upb_arena *arena = Arena_get(self->arena);
|
303
|
+
if (upb_fielddef_ismap(f)) {
|
304
|
+
upb_map *map = upb_msg_mutable(msg, f, arena).map;
|
305
|
+
const upb_fielddef *key_f = map_field_key(f);
|
306
|
+
const upb_fielddef *val_f = map_field_value(f);
|
307
|
+
upb_fieldtype_t key_type = upb_fielddef_type(key_f);
|
308
|
+
TypeInfo value_type_info = TypeInfo_get(val_f);
|
309
|
+
return Map_GetRubyWrapper(map, key_type, value_type_info, self->arena);
|
310
|
+
} else if (upb_fielddef_isseq(f)) {
|
311
|
+
upb_array *arr = upb_msg_mutable(msg, f, arena).array;
|
312
|
+
return RepeatedField_GetRubyWrapper(arr, TypeInfo_get(f), self->arena);
|
313
|
+
} else if (upb_fielddef_issubmsg(f)) {
|
314
|
+
if (!upb_msg_has(self->msg, f)) return Qnil;
|
315
|
+
upb_msg *submsg = upb_msg_mutable(msg, f, arena).msg;
|
316
|
+
const upb_msgdef *m = upb_fielddef_msgsubdef(f);
|
317
|
+
return Message_GetRubyWrapper(submsg, m, self->arena);
|
318
|
+
} else {
|
319
|
+
upb_msgval msgval = upb_msg_get(self->msg, f);
|
320
|
+
return Convert_UpbToRuby(msgval, TypeInfo_get(f), self->arena);
|
321
|
+
}
|
322
|
+
}
|
323
|
+
|
295
324
|
static VALUE Message_field_accessor(VALUE _self, const upb_fielddef* f,
|
296
325
|
int accessor_type, int argc, VALUE* argv) {
|
297
326
|
upb_arena *arena = Arena_get(Message_GetArena(_self));
|
@@ -350,36 +379,11 @@ static VALUE Message_field_accessor(VALUE _self, const upb_fielddef* f,
|
|
350
379
|
return INT2NUM(msgval.int32_val);
|
351
380
|
}
|
352
381
|
}
|
353
|
-
case METHOD_GETTER:
|
354
|
-
|
355
|
-
// This is a special-case: upb_msg_mutable() for map & array are logically
|
356
|
-
// const (they will not change what is serialized) but physically
|
357
|
-
// non-const, as they do allocate a repeated field or map. The logical
|
358
|
-
// constness means it's ok to do even if the message is frozen.
|
359
|
-
upb_msg *msg = (upb_msg*)self->msg;
|
360
|
-
if (upb_fielddef_ismap(f)) {
|
361
|
-
upb_map *map = upb_msg_mutable(msg, f, arena).map;
|
362
|
-
const upb_fielddef *key_f = map_field_key(f);
|
363
|
-
const upb_fielddef *val_f = map_field_value(f);
|
364
|
-
upb_fieldtype_t key_type = upb_fielddef_type(key_f);
|
365
|
-
TypeInfo value_type_info = TypeInfo_get(val_f);
|
366
|
-
return Map_GetRubyWrapper(map, key_type, value_type_info, self->arena);
|
367
|
-
} else if (upb_fielddef_isseq(f)) {
|
368
|
-
upb_array *arr = upb_msg_mutable(msg, f, arena).array;
|
369
|
-
return RepeatedField_GetRubyWrapper(arr, TypeInfo_get(f), self->arena);
|
370
|
-
} else if (upb_fielddef_issubmsg(f)) {
|
371
|
-
if (!upb_msg_has(self->msg, f)) return Qnil;
|
372
|
-
upb_msg *submsg = upb_msg_mutable(msg, f, arena).msg;
|
373
|
-
const upb_msgdef *m = upb_fielddef_msgsubdef(f);
|
374
|
-
return Message_GetRubyWrapper(submsg, m, self->arena);
|
375
|
-
} else {
|
376
|
-
upb_msgval msgval = upb_msg_get(self->msg, f);
|
377
|
-
return Convert_UpbToRuby(msgval, TypeInfo_get(f), self->arena);
|
378
|
-
}
|
382
|
+
case METHOD_GETTER:
|
383
|
+
return Message_getfield(_self, f);
|
379
384
|
default:
|
380
385
|
rb_raise(rb_eRuntimeError, "Internal error, no such accessor: %d",
|
381
386
|
accessor_type);
|
382
|
-
}
|
383
387
|
}
|
384
388
|
}
|
385
389
|
|
@@ -866,7 +870,6 @@ static VALUE Message_freeze(VALUE _self) {
|
|
866
870
|
static VALUE Message_index(VALUE _self, VALUE field_name) {
|
867
871
|
Message* self = ruby_to_Message(_self);
|
868
872
|
const upb_fielddef* field;
|
869
|
-
upb_msgval val;
|
870
873
|
|
871
874
|
Check_Type(field_name, T_STRING);
|
872
875
|
field = upb_msgdef_ntofz(self->msgdef, RSTRING_PTR(field_name));
|
@@ -875,8 +878,7 @@ static VALUE Message_index(VALUE _self, VALUE field_name) {
|
|
875
878
|
return Qnil;
|
876
879
|
}
|
877
880
|
|
878
|
-
|
879
|
-
return Convert_UpbToRuby(val, TypeInfo_get(field), self->arena);
|
881
|
+
return Message_getfield(_self, field);
|
880
882
|
}
|
881
883
|
|
882
884
|
/*
|
@@ -1285,7 +1287,7 @@ const upb_msg* Message_GetUpbMessage(VALUE value, const upb_msgdef* m,
|
|
1285
1287
|
if (!rb_obj_is_kind_of(value, rb_cNumeric)) goto badtype;
|
1286
1288
|
|
1287
1289
|
sec.int64_val = NUM2LL(value);
|
1288
|
-
nsec.int32_val = (NUM2DBL(value) - NUM2LL(value)) * 1000000000;
|
1290
|
+
nsec.int32_val = round((NUM2DBL(value) - NUM2LL(value)) * 1000000000);
|
1289
1291
|
upb_msg_set(msg, sec_f, sec, arena);
|
1290
1292
|
upb_msg_set(msg, nsec_f, nsec, arena);
|
1291
1293
|
return msg;
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/tests/basic.rb
CHANGED
@@ -31,6 +31,33 @@ module BasicTest
|
|
31
31
|
end
|
32
32
|
include CommonTests
|
33
33
|
|
34
|
+
def test_issue_8311_crash
|
35
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
36
|
+
add_file("inner.proto", :syntax => :proto3) do
|
37
|
+
add_message "Inner" do
|
38
|
+
# Removing either of these fixes the segfault.
|
39
|
+
optional :foo, :string, 1
|
40
|
+
optional :bar, :string, 2
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
46
|
+
add_file("outer.proto", :syntax => :proto3) do
|
47
|
+
add_message "Outer" do
|
48
|
+
repeated :inners, :message, 1, "Inner"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
outer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Outer").msgclass
|
54
|
+
|
55
|
+
outer_proto = outer.new(
|
56
|
+
inners: []
|
57
|
+
)
|
58
|
+
outer_proto['inners'].to_s
|
59
|
+
end
|
60
|
+
|
34
61
|
def test_has_field
|
35
62
|
m = TestSingularFields.new
|
36
63
|
assert !m.has_singular_msg?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-protobuf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.15.
|
4
|
+
version: 3.15.1
|
5
5
|
platform: x64-mingw32
|
6
6
|
authors:
|
7
7
|
- Protobuf Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler-dock
|
@@ -128,7 +128,7 @@ homepage: https://developers.google.com/protocol-buffers
|
|
128
128
|
licenses:
|
129
129
|
- BSD-3-Clause
|
130
130
|
metadata:
|
131
|
-
source_code_uri: https://github.com/protocolbuffers/protobuf/tree/v3.15.
|
131
|
+
source_code_uri: https://github.com/protocolbuffers/protobuf/tree/v3.15.1/ruby
|
132
132
|
post_install_message:
|
133
133
|
rdoc_options: []
|
134
134
|
require_paths:
|