Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package rubygem-msgpack for openSUSE:Factory checked in at 2022-08-27 11:50:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-msgpack (Old) and /work/SRC/openSUSE:Factory/.rubygem-msgpack.new.2083 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-msgpack" Sat Aug 27 11:50:09 2022 rev:20 rq:999447 version:1.5.6 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-msgpack/rubygem-msgpack.changes 2022-08-09 15:26:57.101385059 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-msgpack.new.2083/rubygem-msgpack.changes 2022-08-27 11:50:12.317857923 +0200 @@ -1,0 +2,7 @@ +Fri Aug 26 16:30:50 UTC 2022 - Manuel Schnitzer <mschnit...@suse.com> + +- updated to version 1.5.6 + + * No actual code change, just re-release the `java` version properly. + +------------------------------------------------------------------- Old: ---- msgpack-1.5.4.gem New: ---- msgpack-1.5.6.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-msgpack.spec ++++++ --- /var/tmp/diff_new_pack.uk9hmx/_old 2022-08-27 11:50:12.845859058 +0200 +++ /var/tmp/diff_new_pack.uk9hmx/_new 2022-08-27 11:50:12.849859066 +0200 @@ -24,7 +24,7 @@ # Name: rubygem-msgpack -Version: 1.5.4 +Version: 1.5.6 Release: 0 %define mod_name msgpack %define mod_full_name %{mod_name}-%{version} ++++++ msgpack-1.5.4.gem -> msgpack-1.5.6.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ChangeLog new/ChangeLog --- old/ChangeLog 2022-07-25 09:34:23.000000000 +0200 +++ new/ChangeLog 2022-08-23 09:31:54.000000000 +0200 @@ -1,4 +1,12 @@ -2022-07-25 +2022-08-23 1.5.6: + +* No actual code change, just re-release the `java` version properly. + +2022-08-22 1.5.5: + +* Fix a segfault when GC triggers inside a recursive extension. + +2022-07-25 1.5.4: * Fix a segfault when deserializing empty symbol (`:""`). * Improve compilation flags to not strip debug symbols. Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ext/msgpack/buffer.c new/ext/msgpack/buffer.c --- old/ext/msgpack/buffer.c 2022-07-25 09:34:23.000000000 +0200 +++ new/ext/msgpack/buffer.c 2022-08-23 09:31:54.000000000 +0200 @@ -613,9 +613,11 @@ size_t _msgpack_buffer_read_from_io_to_string(msgpack_buffer_t* b, VALUE string, size_t length) { +#define MIN(x, y) (((x) < (y)) ? (x) : (y)) + if(RSTRING_LEN(string) == 0) { /* direct read */ - VALUE ret = rb_funcall(b->io, b->io_partial_read_method, 2, SIZET2NUM(length), string); + VALUE ret = rb_funcall(b->io, b->io_partial_read_method, 2, SIZET2NUM(MIN(b->io_buffer_size, length)), string); if(ret == Qnil) { return 0; } @@ -627,7 +629,7 @@ b->io_buffer = rb_str_buf_new(0); } - VALUE ret = rb_funcall(b->io, b->io_partial_read_method, 2, SIZET2NUM(length), b->io_buffer); + VALUE ret = rb_funcall(b->io, b->io_partial_read_method, 2, SIZET2NUM(MIN(b->io_buffer_size, length)), b->io_buffer); if(ret == Qnil) { return 0; } @@ -635,6 +637,8 @@ rb_str_buf_cat(string, (const void*)RSTRING_PTR(b->io_buffer), rl); return rl; + +#undef MIN } size_t _msgpack_buffer_skip_from_io(msgpack_buffer_t* b, size_t length) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ext/msgpack/unpacker.c new/ext/msgpack/unpacker.c --- old/ext/msgpack/unpacker.c 2022-07-25 09:34:23.000000000 +0200 +++ new/ext/msgpack/unpacker.c 2022-08-23 09:31:54.000000000 +0200 @@ -60,13 +60,16 @@ #define HEAD_BYTE_REQUIRED 0xc1 static inline msgpack_unpacker_stack_t* _msgpack_unpacker_new_stack(void) { + msgpack_unpacker_stack_t *stack = ZALLOC(msgpack_unpacker_stack_t); + stack->capacity = MSGPACK_UNPACKER_STACK_CAPACITY; #ifdef UNPACKER_STACK_RMEM - return msgpack_rmem_alloc(&s_stack_rmem); + stack->data = msgpack_rmem_alloc(&s_stack_rmem); /*memset(uk->stack, 0, MSGPACK_UNPACKER_STACK_CAPACITY);*/ #else - /*uk->stack = calloc(MSGPACK_UNPACKER_STACK_CAPACITY, sizeof(msgpack_unpacker_stack_t));*/ - return xmalloc(MSGPACK_UNPACKER_STACK_CAPACITY * sizeof(msgpack_unpacker_stack_t)); + /*uk->stack = calloc(MSGPACK_UNPACKER_STACK_CAPACITY, sizeof(msgpack_unpacker_stack_entry_t));*/ + stack->data = xmalloc(MSGPACK_UNPACKER_STACK_CAPACITY * sizeof(msgpack_unpacker_stack_entry_t)); #endif + return stack; } msgpack_unpacker_t* _msgpack_unpacker_new(void) @@ -81,17 +84,17 @@ uk->reading_raw = Qnil; uk->stack = _msgpack_unpacker_new_stack(); - uk->stack_capacity = MSGPACK_UNPACKER_STACK_CAPACITY; return uk; } static inline void _msgpack_unpacker_free_stack(msgpack_unpacker_stack_t* stack) { #ifdef UNPACKER_STACK_RMEM - msgpack_rmem_free(&s_stack_rmem, stack); + msgpack_rmem_free(&s_stack_rmem, stack->data); #else - xfree(stack); + xfree(stack->data); #endif + xfree(stack); } void _msgpack_unpacker_destroy(msgpack_unpacker_t* uk) @@ -100,18 +103,24 @@ msgpack_buffer_destroy(UNPACKER_BUFFER_(uk)); } +void msgpack_unpacker_mark_stack(msgpack_unpacker_stack_t* stack) +{ + while (stack) { + msgpack_unpacker_stack_entry_t* s = stack->data; + msgpack_unpacker_stack_entry_t* send = stack->data + stack->depth; + for(; s < send; s++) { + rb_gc_mark(s->object); + rb_gc_mark(s->key); + } + stack = stack->parent; + } +} + void msgpack_unpacker_mark(msgpack_unpacker_t* uk) { rb_gc_mark(uk->last_object); rb_gc_mark(uk->reading_raw); - - msgpack_unpacker_stack_t* s = uk->stack; - msgpack_unpacker_stack_t* send = uk->stack + uk->stack_depth; - for(; s < send; s++) { - rb_gc_mark(s->object); - rb_gc_mark(s->key); - } - + msgpack_unpacker_mark_stack(uk->stack); /* See MessagePack_Buffer_wrap */ /* msgpack_buffer_mark(UNPACKER_BUFFER_(uk)); */ rb_gc_mark(uk->buffer_ref); @@ -123,9 +132,8 @@ uk->head_byte = HEAD_BYTE_REQUIRED; - /*memset(uk->stack, 0, sizeof(msgpack_unpacker_t) * uk->stack_depth);*/ - uk->stack_depth = 0; - + /*memset(uk->stack, 0, sizeof(msgpack_unpacker_t) * uk->stack->depth);*/ + uk->stack->depth = 0; uk->last_object = Qnil; uk->reading_raw = Qnil; uk->reading_raw_remaining = 0; @@ -201,37 +209,37 @@ } /* stack funcs */ -static inline msgpack_unpacker_stack_t* _msgpack_unpacker_stack_top(msgpack_unpacker_t* uk) +static inline msgpack_unpacker_stack_entry_t* _msgpack_unpacker_stack_entry_top(msgpack_unpacker_t* uk) { - return &uk->stack[uk->stack_depth-1]; + return &uk->stack->data[uk->stack->depth-1]; } static inline int _msgpack_unpacker_stack_push(msgpack_unpacker_t* uk, enum stack_type_t type, size_t count, VALUE object) { reset_head_byte(uk); - if(uk->stack_capacity - uk->stack_depth <= 0) { + if(uk->stack->capacity - uk->stack->depth <= 0) { return PRIMITIVE_STACK_TOO_DEEP; } - msgpack_unpacker_stack_t* next = &uk->stack[uk->stack_depth]; + msgpack_unpacker_stack_entry_t* next = &uk->stack->data[uk->stack->depth]; next->count = count; next->type = type; next->object = object; next->key = Qnil; - uk->stack_depth++; + uk->stack->depth++; return PRIMITIVE_CONTAINER_START; } static inline VALUE msgpack_unpacker_stack_pop(msgpack_unpacker_t* uk) { - return --uk->stack_depth; + return --uk->stack->depth; } static inline bool msgpack_unpacker_stack_is_empty(msgpack_unpacker_t* uk) { - return uk->stack_depth == 0; + return uk->stack->depth == 0; } #ifdef USE_CASE_RANGE @@ -259,8 +267,8 @@ static inline bool is_reading_map_key(msgpack_unpacker_t* uk) { - if(uk->stack_depth > 0) { - msgpack_unpacker_stack_t* top = _msgpack_unpacker_stack_top(uk); + if(uk->stack->depth > 0) { + msgpack_unpacker_stack_entry_t* top = _msgpack_unpacker_stack_entry_top(uk); if(top->type == STACK_TYPE_MAP_KEY) { return true; } @@ -314,20 +322,14 @@ reset_head_byte(uk); uk->reading_raw_remaining = 0; - msgpack_unpacker_stack_t* stack = uk->stack; - size_t stack_depth = uk->stack_depth; - size_t stack_capacity = uk->stack_capacity; - - uk->stack = _msgpack_unpacker_new_stack(); - uk->stack_depth = 0; - uk->stack_capacity = MSGPACK_UNPACKER_STACK_CAPACITY; + msgpack_unpacker_stack_t* child_stack = _msgpack_unpacker_new_stack(); + child_stack->parent = uk->stack; + uk->stack = child_stack; obj = rb_funcall(proc, s_call, 1, uk->buffer.owner); - _msgpack_unpacker_free_stack(uk->stack); - uk->stack = stack; - uk->stack_depth = stack_depth; - uk->stack_capacity = stack_capacity; + uk->stack = child_stack->parent; + _msgpack_unpacker_free_stack(child_stack); return object_complete(uk, obj); } @@ -737,7 +739,7 @@ container_completed: { - msgpack_unpacker_stack_t* top = _msgpack_unpacker_stack_top(uk); + msgpack_unpacker_stack_entry_t* top = _msgpack_unpacker_stack_entry_top(uk); switch(top->type) { case STACK_TYPE_ARRAY: rb_ary_push(top->object, uk->last_object); @@ -787,7 +789,7 @@ container_completed: { - msgpack_unpacker_stack_t* top = _msgpack_unpacker_stack_top(uk); + msgpack_unpacker_stack_entry_t* top = _msgpack_unpacker_stack_entry_top(uk); /* this section optimized out */ // TODO object_complete still creates objects which should be optimized out diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ext/msgpack/unpacker.h new/ext/msgpack/unpacker.h --- old/ext/msgpack/unpacker.h 2022-07-25 09:34:23.000000000 +0200 +++ new/ext/msgpack/unpacker.h 2022-08-23 09:31:54.000000000 +0200 @@ -27,6 +27,7 @@ struct msgpack_unpacker_t; typedef struct msgpack_unpacker_t msgpack_unpacker_t; +typedef struct msgpack_unpacker_stack_t msgpack_unpacker_stack_t; enum stack_type_t { STACK_TYPE_ARRAY, @@ -39,19 +40,22 @@ enum stack_type_t type; VALUE object; VALUE key; -} msgpack_unpacker_stack_t; +} msgpack_unpacker_stack_entry_t; + +struct msgpack_unpacker_stack_t { + size_t depth; + size_t capacity; + msgpack_unpacker_stack_entry_t *data; + msgpack_unpacker_stack_t *parent; +}; #define MSGPACK_UNPACKER_STACK_SIZE (8+4+8+8) /* assumes size_t <= 64bit, enum <= 32bit, VALUE <= 64bit */ struct msgpack_unpacker_t { msgpack_buffer_t buffer; - + msgpack_unpacker_stack_t *stack; unsigned int head_byte; - msgpack_unpacker_stack_t* stack; - size_t stack_depth; - size_t stack_capacity; - VALUE last_object; VALUE reading_raw; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/msgpack/version.rb new/lib/msgpack/version.rb --- old/lib/msgpack/version.rb 2022-07-25 09:34:23.000000000 +0200 +++ new/lib/msgpack/version.rb 2022-08-23 09:31:54.000000000 +0200 @@ -1,5 +1,5 @@ module MessagePack - VERSION = "1.5.4" + VERSION = "1.5.6" # Note for maintainers: # Don't miss building/releasing the JRuby version (rake buld:java) # See "How to build -java rubygems" in README for more details. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2022-07-25 09:34:23.000000000 +0200 +++ new/metadata 2022-08-23 09:31:54.000000000 +0200 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: msgpack version: !ruby/object:Gem::Version - version: 1.5.4 + version: 1.5.6 platform: ruby authors: - Sadayuki Furuhashi @@ -10,7 +10,7 @@ autorequire: bindir: bin cert_chain: [] -date: 2022-07-25 00:00:00.000000000 Z +date: 2022-08-23 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: bundler diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/factory_spec.rb new/spec/factory_spec.rb --- old/spec/factory_spec.rb 2022-07-25 09:34:23.000000000 +0200 +++ new/spec/factory_spec.rb 2022-08-23 09:31:54.000000000 +0200 @@ -587,6 +587,30 @@ GC.stress = false end end + + it 'does not crash in recursive extensions' do + my_hash_type = Class.new(Hash) + factory = MessagePack::Factory.new + factory.register_type(7, + my_hash_type, + packer: ->(value, packer) do + packer.write(value.to_h) + end, + unpacker: ->(unpacker) { my_hash_type.new(unpacker.read) }, + recursive: true, + ) + + payload = factory.dump( + [my_hash_type.new] + ) + + begin + GC.stress = true + factory.load(payload) + ensure + GC.stress = false + end + end end describe 'DefaultFactory' do