google-protobuf 3.0.0-x86-linux → 3.0.2-x86-linux

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9fe7168a154abbcb7d78704c952ab1896bf12b20
4
- data.tar.gz: 8d8f2fdd5b71a20818e51f4156da8227e57026ad
3
+ metadata.gz: d6d3dbf927f8695f787e15287da51530470ce2ea
4
+ data.tar.gz: 16b9088041fec9738c35570f8e90fa4833bbb905
5
5
  SHA512:
6
- metadata.gz: 2854c00f4745af1081fdb1932c26e16f76121a0443e5f2913c695b0d761c4ae35fb04ab7ff4a4a9a451b0d5660b4a0119a13f36a82f119c96716d1a85f26a198
7
- data.tar.gz: 9eae2f03ebe7b74ea2ec885a808c0c1f42dcfc9f565a864249f47317f6c29c7f742baedc59ba78a17200d5928d81201aadb26594ecaee64af1dd11e3be03b093
6
+ metadata.gz: 2102b82a430588a00c26795ac438b458cd87e5eb8e887de9d04735cb5734ed5dbc47e0dbb0274af702589289b9c41391f5b86fd3fc98898c900825c1f0b75118
7
+ data.tar.gz: f6278515cb9ea1c8745ece9558334e67be149027230b0d9bdb99215cfe9a7bf2216777431b6dae0b27c4bf3514c2e67890fa978c140c2dab78a32f395bd7dbe9
@@ -255,10 +255,54 @@ typedef struct {
255
255
  // value into the map.
256
256
  typedef struct {
257
257
  VALUE map;
258
+ const map_handlerdata_t* handlerdata;
258
259
  char key_storage[NATIVE_SLOT_MAX_SIZE];
259
260
  char value_storage[NATIVE_SLOT_MAX_SIZE];
260
261
  } map_parse_frame_t;
261
262
 
263
+ static void MapParseFrame_mark(void* _self) {
264
+ map_parse_frame_t* frame = _self;
265
+
266
+ // This shouldn't strictly be necessary since this should be rooted by the
267
+ // message itself, but it can't hurt.
268
+ rb_gc_mark(frame->map);
269
+
270
+ native_slot_mark(frame->handlerdata->key_field_type, &frame->key_storage);
271
+ native_slot_mark(frame->handlerdata->value_field_type, &frame->value_storage);
272
+ }
273
+
274
+ void MapParseFrame_free(void* self) {
275
+ xfree(self);
276
+ }
277
+
278
+ rb_data_type_t MapParseFrame_type = {
279
+ "MapParseFrame",
280
+ { MapParseFrame_mark, MapParseFrame_free, NULL },
281
+ };
282
+
283
+ // Array of Ruby objects wrapping map_parse_frame_t.
284
+ // We don't allow multiple concurrent decodes, so we assume that this global
285
+ // variable is specific to the "current" decode.
286
+ VALUE map_parse_frames;
287
+
288
+ static map_parse_frame_t* map_push_frame(VALUE map,
289
+ const map_handlerdata_t* handlerdata) {
290
+ map_parse_frame_t* frame = ALLOC(map_parse_frame_t);
291
+ frame->handlerdata = handlerdata;
292
+ frame->map = map;
293
+ native_slot_init(handlerdata->key_field_type, &frame->key_storage);
294
+ native_slot_init(handlerdata->value_field_type, &frame->value_storage);
295
+
296
+ rb_ary_push(map_parse_frames,
297
+ TypedData_Wrap_Struct(rb_cObject, &MapParseFrame_type, frame));
298
+
299
+ return frame;
300
+ }
301
+
302
+ static void map_pop_frame() {
303
+ rb_ary_pop(map_parse_frames);
304
+ }
305
+
262
306
  // Handler to begin a map entry: allocates a temporary frame. This is the
263
307
  // 'startsubmsg' handler on the msgdef that contains the map field.
264
308
  static void *startmapentry_handler(void *closure, const void *hd) {
@@ -266,13 +310,7 @@ static void *startmapentry_handler(void *closure, const void *hd) {
266
310
  const map_handlerdata_t* mapdata = hd;
267
311
  VALUE map_rb = DEREF(msg, mapdata->ofs, VALUE);
268
312
 
269
- map_parse_frame_t* frame = ALLOC(map_parse_frame_t);
270
- frame->map = map_rb;
271
-
272
- native_slot_init(mapdata->key_field_type, &frame->key_storage);
273
- native_slot_init(mapdata->value_field_type, &frame->value_storage);
274
-
275
- return frame;
313
+ return map_push_frame(map_rb, mapdata);
276
314
  }
277
315
 
278
316
  // Handler to end a map entry: inserts the value defined during the message into
@@ -298,7 +336,7 @@ static bool endmap_handler(void *closure, const void *hd, upb_status* s) {
298
336
  &frame->value_storage);
299
337
 
300
338
  Map_index_set(frame->map, key, value);
301
- xfree(frame);
339
+ map_pop_frame();
302
340
 
303
341
  return true;
304
342
  }
@@ -737,6 +775,10 @@ VALUE Message_decode(VALUE klass, VALUE data) {
737
775
  msg_rb = rb_class_new_instance(0, NULL, msgklass);
738
776
  TypedData_Get_Struct(msg_rb, MessageHeader, &Message_type, msg);
739
777
 
778
+ // We generally expect this to be clear already, but clear it in case parsing
779
+ // previously got interrupted somehow.
780
+ rb_ary_clear(map_parse_frames);
781
+
740
782
  {
741
783
  const upb_pbdecodermethod* method = msgdef_decodermethod(desc);
742
784
  const upb_handlers* h = upb_pbdecodermethod_desthandlers(method);
@@ -781,6 +823,10 @@ VALUE Message_decode_json(VALUE klass, VALUE data) {
781
823
  msg_rb = rb_class_new_instance(0, NULL, msgklass);
782
824
  TypedData_Get_Struct(msg_rb, MessageHeader, &Message_type, msg);
783
825
 
826
+ // We generally expect this to be clear already, but clear it in case parsing
827
+ // previously got interrupted somehow.
828
+ rb_ary_clear(map_parse_frames);
829
+
784
830
  {
785
831
  const upb_json_parsermethod* method = msgdef_jsonparsermethod(desc);
786
832
  stackenv se;
@@ -112,4 +112,6 @@ void Init_protobuf_c() {
112
112
 
113
113
  upb_def_to_ruby_obj_map = rb_hash_new();
114
114
  rb_gc_register_address(&upb_def_to_ruby_obj_map);
115
+ map_parse_frames = rb_ary_new();
116
+ rb_gc_register_address(&map_parse_frames);
115
117
  }
@@ -166,6 +166,8 @@ extern VALUE cBuilder;
166
166
  extern VALUE cError;
167
167
  extern VALUE cParseError;
168
168
 
169
+ extern VALUE map_parse_frames;
170
+
169
171
  // We forward-declare all of the Ruby method implementations here because we
170
172
  // sometimes call the methods directly across .c files, rather than going
171
173
  // through Ruby's method dispatching (e.g. during message parse). It's cleaner
@@ -11175,7 +11175,7 @@ static bool parse_mapentry_key(upb_json_parser *p) {
11175
11175
  sel = getsel_for_handlertype(p, UPB_HANDLER_STRING);
11176
11176
  upb_sink_putstring(&subsink, sel, buf, len, NULL);
11177
11177
  sel = getsel_for_handlertype(p, UPB_HANDLER_ENDSTR);
11178
- upb_sink_endstr(&subsink, sel);
11178
+ upb_sink_endstr(&p->top->sink, sel);
11179
11179
  multipart_end(p);
11180
11180
  break;
11181
11181
  }
Binary file
Binary file
Binary file
Binary file
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.0.0
4
+ version: 3.0.2
5
5
  platform: x86-linux
6
6
  authors:
7
7
  - Protobuf Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-29 00:00:00.000000000 Z
11
+ date: 2016-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler-dock