From: gregor herrmann Date: Fri, 10 Jul 2020 16:36:05 +0000 (+0200) Subject: New upstream version 4.017+ds X-Git-Tag: archive/raspbian/4.017+ds-1+rpi1^2~3^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=6308d40337a1be90c48cd663ebc8fd0c75a18686;p=libsereal-encoder-perl.git New upstream version 4.017+ds --- diff --git a/Changes b/Changes index 2f74359..4360d3f 100644 --- a/Changes +++ b/Changes @@ -5,6 +5,15 @@ Revision history for Perl extension Sereal-Encoder * of the decoder before upgrading to version 4 of the * * encoder! * **************************************************************** +4.017 Thurs July 9, 2020 + * The build fixes in 4.016 didn't work correctly, this should fix them. + +4.016 Thurs July 9, 2020 + * Fix some dependency issues in build process + +4.015 Weds July 8, 2020 + * Build fixes (missing dependency) + 4.014 Thurs June 11, 2020 * Fix build issue on non-win32 platforms. * Update zstd to 1.4.5 diff --git a/META.json b/META.json index f440fe4..83345e3 100644 --- a/META.json +++ b/META.json @@ -4,7 +4,7 @@ "Steffen Mueller , Yves Orton " ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 7.36, CPAN::Meta::Converter version 2.150010", + "generated_by" : "ExtUtils::MakeMaker version 7.46, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], @@ -24,7 +24,8 @@ "requires" : { "ExtUtils::ParseXS" : "2.21", "File::Find" : "0", - "File::Path" : "0" + "File::Path" : "0", + "Test::LongString" : "0" } }, "configure" : { @@ -62,6 +63,6 @@ "url" : "git://github.com/Sereal/Sereal.git" } }, - "version" : "4.014", + "version" : "4.017", "x_serialization_backend" : "JSON::PP version 2.27400" } diff --git a/META.yml b/META.yml index 39b81ca..2ffbf01 100644 --- a/META.yml +++ b/META.yml @@ -18,7 +18,7 @@ build_requires: configure_requires: ExtUtils::MakeMaker: '7.0' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 7.36, CPAN::Meta::Converter version 2.150010' +generated_by: 'ExtUtils::MakeMaker version 7.46, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -34,5 +34,5 @@ requires: resources: bugtracker: https://github.com/Sereal/Sereal/issues repository: git://github.com/Sereal/Sereal.git -version: '4.014' -x_serialization_backend: 'CPAN::Meta::YAML version 0.011' +version: '4.017' +x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff --git a/Makefile.PL b/Makefile.PL index 2d365a0..d859b46 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -76,6 +76,7 @@ inc::Sereal::BuildTools::WriteMakefile( 'File::Find' => 0, 'File::Path' => 0, 'ExtUtils::ParseXS' => '2.21', + 'Test::LongString' => '0', }, CONFIGURE_REQUIRES => { 'ExtUtils::MakeMaker' => '7.0', diff --git a/author_tools/hobodecoder.pl b/author_tools/hobodecoder.pl index eaaa079..77675c6 100644 --- a/author_tools/hobodecoder.pl +++ b/author_tools/hobodecoder.pl @@ -136,7 +136,7 @@ sub parse_long_double { return unpack( "D", $v ); } -my $fmt1= "%06u/%06u: %02x%1s %03s %s"; +my $fmt1= "%06d/%06d: %02x%1s %03s %s"; my $fmt2= "%-6s %-6s %-2s%1s %-3s %s"; my $lead_items= 5; # 1 less than the fmt2 @@ -229,7 +229,8 @@ sub parse_sv { parse_sv($ind); } elsif ( $o == SRL_HDR_PAD ) { - printf "PAD\n"; + printf "[PAD]\n"; + parse_sv($ind); } elsif ( $o == SRL_HDR_ALIAS ) { my $ofs= varint(); @@ -354,7 +355,9 @@ close $fh; print "\n\nTotal length: " . length($data) . "\n\n"; -parse_header(); while ( length $data ) { + parse_header(); + print "--- End header\n"; $done= parse_sv(""); + print "--- End Document\n"; } diff --git a/lib/Sereal/Encoder.pm b/lib/Sereal/Encoder.pm index 1f06614..3b78213 100644 --- a/lib/Sereal/Encoder.pm +++ b/lib/Sereal/Encoder.pm @@ -5,7 +5,7 @@ use warnings; use Carp qw/croak/; use XSLoader; -our $VERSION= '4.014'; # Don't forget to update the TestCompat set for testing against installed decoders! +our $VERSION= '4.017'; # Don't forget to update the TestCompat set for testing against installed decoders! our $XS_VERSION= $VERSION; $VERSION= eval $VERSION; # not for public consumption, just for testing. @@ -537,7 +537,7 @@ in both time and space efficiency with the best alternatives. This mechanism is enabled using the C option of the encoder. It is inspired by the equivalent mechanism in L and differs only in one minor detail, explained below. The general mechanism is documented -in the I section of L. +in the I section of L. Similar to CBOR using C, Sereal uses the string C as a serializer identifier for the callbacks. diff --git a/lib/Sereal/Encoder/Constants.pm b/lib/Sereal/Encoder/Constants.pm index d3f2b4d..3091687 100644 --- a/lib/Sereal/Encoder/Constants.pm +++ b/lib/Sereal/Encoder/Constants.pm @@ -4,7 +4,7 @@ use warnings; require Exporter; our @ISA= qw(Exporter); -our $VERSION= '4.014'; # Don't forget to update the TestCompat set for testing against installed encoders! +our $VERSION= '4.017'; # Don't forget to update the TestCompat set for testing against installed encoders! our ( @EXPORT_OK, %DEFINE, %TAG_INFO_HASH, @TAG_INFO_ARRAY ); diff --git a/srl_reader_decompress.h b/srl_reader_decompress.h index 1a1820c..de68b0f 100644 --- a/srl_reader_decompress.h +++ b/srl_reader_decompress.h @@ -48,15 +48,43 @@ SRL_STATIC_INLINE SV * srl_realloc_empty_buffer(pTHX_ srl_reader_buffer_t *buf, const STRLEN header_len, - const STRLEN body_len) + const STRLEN body_len, + const STRLEN compressed_len, + char *compression_type, + size_t max_uncompressed_size) { SV *b_sv; srl_reader_char_ptr b; + /* Sereal::Merger & Sereal::Path::Iterator do not have this option yet */ + if ((max_uncompressed_size != 0) && (body_len > max_uncompressed_size)) + croak("The expected uncompressed size is larger than the allowed maximum size"); + /* Let perl clean this up. Yes, it's not the most efficient thing * ever, but it's just one mortal per full decompression, so not * a bottle-neck. */ - b_sv = sv_2mortal( newSV(header_len + body_len + 1 )); + if (0) { + b_sv = sv_2mortal( newSV(header_len + body_len + 1 )); + } else { + STRLEN total_requested= header_len + body_len + 1; + char *tmp_buf; + + if (total_requested < body_len) + croak("Decompressed buffer is impossibly large. Refusing to decode."); + + tmp_buf= Perl_malloc(total_requested); /* perl well defined malloc wrapper */ + + if (!tmp_buf) + croak("Insufficient memory to '%s' decompress. Size compressed=%"UVuf" uncompressed=%"UVuf, + compression_type, compressed_len, total_requested ); + + b_sv= sv_newmortal(); + sv_upgrade(b_sv,SVt_PV); + SvPVX(b_sv)= tmp_buf; + SvPOK_on(b_sv); + SvCUR(b_sv)= header_len + body_len; + SvLEN(b_sv)= total_requested; + } b = (srl_reader_char_ptr) SvPVX(b_sv); buf->start = b; @@ -75,7 +103,7 @@ srl_realloc_empty_buffer(pTHX_ srl_reader_buffer_t *buf, * The caller *MUST* call SRL_RDR_UPDATE_BODY_POS right after existing from this function. */ SRL_STATIC_INLINE UV -srl_decompress_body_snappy(pTHX_ srl_reader_buffer_t *buf, U8 encoding_flags, SV** buf_owner) +srl_decompress_body_snappy(pTHX_ srl_reader_buffer_t *buf, U8 encoding_flags, SV** buf_owner, size_t max_uncompressed_size) { SV *buf_sv; int header_len; @@ -101,7 +129,8 @@ srl_decompress_body_snappy(pTHX_ srl_reader_buffer_t *buf, U8 encoding_flags, SV SRL_RDR_ERROR(buf, "Invalid Snappy header in Snappy-compressed Sereal packet"); /* Allocate output buffer and swap it into place within the bufoder. */ - buf_sv = srl_realloc_empty_buffer(aTHX_ buf, sereal_header_len, dest_len); + buf_sv = srl_realloc_empty_buffer(aTHX_ buf, sereal_header_len, (STRLEN)dest_len, + compressed_packet_len, "Snappy", max_uncompressed_size); if (buf_owner) *buf_owner = buf_sv; decompress_ok = csnappy_decompress_noheader((char *)(old_pos + header_len), @@ -125,7 +154,7 @@ srl_decompress_body_snappy(pTHX_ srl_reader_buffer_t *buf, U8 encoding_flags, SV * The caller *MUST* call SRL_RDR_UPDATE_BODY_POS right after existing from this function. */ SRL_STATIC_INLINE UV -srl_decompress_body_zlib(pTHX_ srl_reader_buffer_t *buf, SV** buf_owner) +srl_decompress_body_zlib(pTHX_ srl_reader_buffer_t *buf, SV** buf_owner, size_t max_uncompressed_size) { SV *buf_sv; mz_ulong tmp; @@ -144,7 +173,8 @@ srl_decompress_body_zlib(pTHX_ srl_reader_buffer_t *buf, SV** buf_owner) bytes_consumed = compressed_packet_len + SRL_RDR_POS_OFS(buf); /* Allocate output buffer and swap it into place within the decoder. */ - buf_sv = srl_realloc_empty_buffer(aTHX_ buf, sereal_header_len, uncompressed_packet_len); + buf_sv = srl_realloc_empty_buffer(aTHX_ buf, sereal_header_len, uncompressed_packet_len, + compressed_packet_len, "ZLIB", max_uncompressed_size); if (buf_owner) *buf_owner = buf_sv; tmp = uncompressed_packet_len; @@ -166,7 +196,7 @@ srl_decompress_body_zlib(pTHX_ srl_reader_buffer_t *buf, SV** buf_owner) * SRL_RDR_UPDATE_BODY_POS right after existing from this function. */ SRL_STATIC_INLINE UV -srl_decompress_body_zstd(pTHX_ srl_reader_buffer_t *buf, SV** buf_owner) +srl_decompress_body_zstd(pTHX_ srl_reader_buffer_t *buf, SV** buf_owner, size_t max_uncompressed_size) { SV *buf_sv; UV bytes_consumed; @@ -187,7 +217,8 @@ srl_decompress_body_zstd(pTHX_ srl_reader_buffer_t *buf, SV** buf_owner) SRL_RDR_ERROR(buf, "Invalid zstd packet with unknown uncompressed size"); /* Allocate output buffer and swap it into place within the decoder. */ - buf_sv = srl_realloc_empty_buffer(aTHX_ buf, sereal_header_len, (STRLEN) uncompressed_packet_len); + buf_sv = srl_realloc_empty_buffer(aTHX_ buf, sereal_header_len, (STRLEN) uncompressed_packet_len, + compressed_packet_len, "zstd", max_uncompressed_size); if (buf_owner) *buf_owner = buf_sv; decompress_code = ZSTD_decompress((void *)buf->pos, (size_t) uncompressed_packet_len,