diff -Nru libjson-xs-perl-3.020/bin/json_xs libjson-xs-perl-3.030/bin/json_xs --- libjson-xs-perl-3.020/bin/json_xs 2016-02-21 15:37:44.000000000 +0000 +++ libjson-xs-perl-3.030/bin/json_xs 2016-09-23 07:44:48.000000000 +0000 @@ -52,8 +52,6 @@ =item none - nothing is read, creates an C scalar - mainly useful with C<-e> -=item cbor - CBOR (via CBOR::XS) - =back =item -t toformat @@ -179,13 +177,12 @@ warn "input text encoding is $enc\n" if $opt_verbose; JSON::XS->new->decode (decode $enc, $_) }, - "cbor" => sub { require CBOR::XS; CBOR::XS::decode_cbor ($_) }, + "cbor" => sub { require CBOR::XS; CBOR::XS->new->allow_cycles->decode ($_) }, "storable" => sub { Storable::thaw $_ }, "storable-file" => sub { open my $fh, "<", \$_; Storable::fd_retrieve $fh }, "bencode" => sub { require Convert::Bencode; Convert::Bencode::bdecode ($_) }, "clzf" => sub { require Compress::LZF; Compress::LZF::sthaw ($_) }, "yaml" => sub { require YAML; YAML::Load ($_) }, - "cbor" => sub { require CBOR::XS; CBOR::XS::decode_cbor ($_) }, "eval" => sub { my $v = eval "no strict; no warnings; no utf8;\n#line 1 \"input\"\n$_"; die "$@" if $@; $v }, ); @@ -226,7 +223,7 @@ or die "$opt_from: not a valid fromformat\n"; $T{$opt_to} - or die "$opt_from: not a valid toformat\n"; + or die "$opt_to: not a valid toformat\n"; if ($opt_from ne "none") { local $/; diff -Nru libjson-xs-perl-3.020/Changes libjson-xs-perl-3.030/Changes --- libjson-xs-perl-3.020/Changes 2016-02-26 21:46:02.000000000 +0000 +++ libjson-xs-perl-3.030/Changes 2016-11-16 19:21:23.000000000 +0000 @@ -5,6 +5,14 @@ TODO: http://stevehanov.ca/blog/index.php?id=104 compression TODO: how to cope with tagged values and standard json decoders TODO: investigate magic (Eric Brine) +TODO: rfc7464 +TODO: Victor Efimov + +3.03 Wed Nov 16 20:20:59 CET 2016 + - fix a bug introduced by a perl bug workaround that would cause + incremental parsing to fail with a sv_chop panic. + - json_xs: toformat failure error message fixed. + - json_xs: allow cyclic data structures in CBOR. 3.02 Fri Feb 26 22:45:20 CET 2016 - allow_nonref now affects booleans (\1, $Types::Serialiser::Boolean) diff -Nru libjson-xs-perl-3.020/debian/changelog libjson-xs-perl-3.030/debian/changelog --- libjson-xs-perl-3.020/debian/changelog 2016-09-20 11:14:56.000000000 +0000 +++ libjson-xs-perl-3.030/debian/changelog 2016-11-28 09:57:52.000000000 +0000 @@ -1,3 +1,12 @@ +libjson-xs-perl (3.030-1) unstable; urgency=medium + + * Team upload. + * Import upstream version 3.030 + * debian/copyright: Update years. + * debian/patches/fix-spelling.patch: Refresh patch. + + -- Angel Abad Mon, 28 Nov 2016 10:57:52 +0100 + libjson-xs-perl (3.020-1) unstable; urgency=medium * Team upload. diff -Nru libjson-xs-perl-3.020/debian/copyright libjson-xs-perl-3.030/debian/copyright --- libjson-xs-perl-3.020/debian/copyright 2016-09-20 11:14:56.000000000 +0000 +++ libjson-xs-perl-3.030/debian/copyright 2016-11-28 09:52:33.000000000 +0000 @@ -10,14 +10,16 @@ Files: debian/* Copyright: 2007, Ivan Kohler - 2008-2010, Angel Abad 2008-2015, gregor herrmann 2008, Niko Tyni 2009, Ansgar Burchardt 2009, Ryan Niebur 2010, Franck Joncourt + 2008-2010, 2016, Angel Abad 2010, Jonathan Yu 2010-2011, Nicholas Bamber + 2012, Alessandro Ghedini + 2016, Nuno Carvalho License: Artistic or GPL-1+ License: Artistic diff -Nru libjson-xs-perl-3.020/debian/patches/fix-spelling.patch libjson-xs-perl-3.030/debian/patches/fix-spelling.patch --- libjson-xs-perl-3.020/debian/patches/fix-spelling.patch 2016-09-20 11:14:56.000000000 +0000 +++ libjson-xs-perl-3.030/debian/patches/fix-spelling.patch 2016-11-28 09:57:19.000000000 +0000 @@ -1,18 +1,18 @@ Description: fix spelling Origin: vendor Author: Nuno Carvalho -Last-Update: 2016-09-20 +Last-Update: 2016-11-28 Bug: https://rt.cpan.org/Ticket/Display.html?id=117976 Forwarded: https://rt.cpan.org/Ticket/Display.html?id=117976 --- a/XS.pm +++ b/XS.pm -@@ -1610,7 +1610,7 @@ +@@ -1614,7 +1614,7 @@ C uses the L module to provide boolean constants. That means that the JSON true and false values will be --comaptible to true and false values of iother modules that do the same, -+compatible to true and false values of iother modules that do the same, +-comaptible to true and false values of other modules that do the same, ++compatible to true and false values of other modules that do the same, such as L and L. diff -Nru libjson-xs-perl-3.020/META.json libjson-xs-perl-3.030/META.json --- libjson-xs-perl-3.020/META.json 2016-02-26 21:46:28.000000000 +0000 +++ libjson-xs-perl-3.030/META.json 2016-11-16 19:21:42.000000000 +0000 @@ -39,5 +39,5 @@ } }, "release_status" : "stable", - "version" : 3.02 + "version" : 3.03 } diff -Nru libjson-xs-perl-3.020/META.yml libjson-xs-perl-3.030/META.yml --- libjson-xs-perl-3.020/META.yml 2016-02-26 21:46:28.000000000 +0000 +++ libjson-xs-perl-3.030/META.yml 2016-11-16 19:21:42.000000000 +0000 @@ -21,4 +21,4 @@ requires: Types::Serialiser: '0' common::sense: '0' -version: 3.02 +version: 3.03 diff -Nru libjson-xs-perl-3.020/README libjson-xs-perl-3.030/README --- libjson-xs-perl-3.020/README 2016-02-26 21:46:28.000000000 +0000 +++ libjson-xs-perl-3.030/README 2016-11-16 19:21:43.000000000 +0000 @@ -678,10 +678,10 @@ And finally, in list context, it will try to extract as many objects from the stream as it can find and return them, or the empty list - otherwise. For this to work, there must be no separators between the - JSON objects or arrays, instead they must be concatenated - back-to-back. If an error occurs, an exception will be raised as in - the scalar context case. Note that in this case, any + otherwise. For this to work, there must be no separators (other than + whitespace) between the JSON objects or arrays, instead they must be + concatenated back-to-back. If an error occurs, an exception will be + raised as in the scalar context case. Note that in this case, any previously-parsed JSON texts will be lost. Example: Parse some JSON arrays/objects in a given string and return @@ -699,6 +699,10 @@ exception, you can also call this method before having parsed anything. + That means you can only use this function to look at or manipulate + text before or after complete JSON objects, not while the parser is + in the middle of parsing a JSON object. + This function is useful in two cases: a) finding the trailing text after a JSON object or b) parsing multiple JSON objects separated by non-JSON text (such as commas). @@ -1483,7 +1487,7 @@ INTEROPERABILITY WITH OTHER MODULES "JSON::XS" uses the Types::Serialiser module to provide boolean constants. That means that the JSON true and false values will be - comaptible to true and false values of iother modules that do the same, + comaptible to true and false values of other modules that do the same, such as JSON::PP and CBOR::XS. INTEROPERABILITY WITH OTHER JSON DECODERS @@ -1507,7 +1511,7 @@ invalid) JSON syntax for serialised objects, and you still want to decode the generated When you want to serialise objects, you can run a regex to replace the tagged syntax by standard JSON arrays (it only - works for "normal" packagesnames without comma, newlines or single + works for "normal" package names without comma, newlines or single colons). First, the readable Perl version: # if your FREEZE methods return no values, you need this replace first: @@ -1551,14 +1555,14 @@ both the original JSON specification on www.json.org and RFC4627. As far as I can see, you can get partial compatibility when parsing by - using "->allow_nonref". However, consider thew security implications of + using "->allow_nonref". However, consider the security implications of doing so. I haven't decided yet when to break compatibility with RFC4627 by default (and potentially leave applications insecure) and change the default to follow RFC7159, but application authors are well advised to call "->allow_nonref(0)" even if this is the current default, if they - cannot handle non-reference values, in preparation for the day when the4 + cannot handle non-reference values, in preparation for the day when the default will change. THREADS diff -Nru libjson-xs-perl-3.020/XS.pm libjson-xs-perl-3.030/XS.pm --- libjson-xs-perl-3.020/XS.pm 2016-02-26 21:46:21.000000000 +0000 +++ libjson-xs-perl-3.030/XS.pm 2016-11-16 19:21:40.000000000 +0000 @@ -103,7 +103,7 @@ use common::sense; -our $VERSION = 3.02; +our $VERSION = 3.03; our @ISA = qw(Exporter); our @EXPORT = qw(encode_json decode_json); @@ -750,11 +750,11 @@ And finally, in list context, it will try to extract as many objects from the stream as it can find and return them, or the empty list -otherwise. For this to work, there must be no separators between the JSON -objects or arrays, instead they must be concatenated back-to-back. If -an error occurs, an exception will be raised as in the scalar context -case. Note that in this case, any previously-parsed JSON texts will be -lost. +otherwise. For this to work, there must be no separators (other than +whitespace) between the JSON objects or arrays, instead they must be +concatenated back-to-back. If an error occurs, an exception will be +raised as in the scalar context case. Note that in this case, any +previously-parsed JSON texts will be lost. Example: Parse some JSON arrays/objects in a given string and return them. @@ -771,6 +771,10 @@ real world conditions). As a special exception, you can also call this method before having parsed anything. +That means you can only use this function to look at or manipulate text +before or after complete JSON objects, not while the parser is in the +middle of parsing a JSON object. + This function is useful in two cases: a) finding the trailing text after a JSON object or b) parsing multiple JSON objects separated by non-JSON text (such as commas). @@ -1610,7 +1614,7 @@ C uses the L module to provide boolean constants. That means that the JSON true and false values will be -comaptible to true and false values of iother modules that do the same, +comaptible to true and false values of other modules that do the same, such as L and L. @@ -1637,7 +1641,7 @@ invalid) JSON syntax for serialised objects, and you still want to decode the generated When you want to serialise objects, you can run a regex to replace the tagged syntax by standard JSON arrays (it only works for -"normal" packagesnames without comma, newlines or single colons). First, +"normal" package names without comma, newlines or single colons). First, the readable Perl version: # if your FREEZE methods return no values, you need this replace first: @@ -1683,14 +1687,14 @@ original JSON specification on www.json.org and RFC4627. As far as I can see, you can get partial compatibility when parsing by -using C<< ->allow_nonref >>. However, consider thew security implications +using C<< ->allow_nonref >>. However, consider the security implications of doing so. I haven't decided yet when to break compatibility with RFC4627 by default (and potentially leave applications insecure) and change the default to follow RFC7159, but application authors are well advised to call C<< ->allow_nonref(0) >> even if this is the current default, if they cannot -handle non-reference values, in preparation for the day when the4 default +handle non-reference values, in preparation for the day when the default will change. diff -Nru libjson-xs-perl-3.020/XS.xs libjson-xs-perl-3.030/XS.xs --- libjson-xs-perl-3.020/XS.xs 2016-02-26 21:41:10.000000000 +0000 +++ libjson-xs-perl-3.030/XS.xs 2016-11-16 19:16:28.000000000 +0000 @@ -320,7 +320,6 @@ return 1; else if (*pv == '0') return 0; - } return -1; @@ -335,11 +334,14 @@ scalar = SvRV (scalar); - if (SvSTASH (scalar) == bool_stash) - return 1; + if (SvTYPE (scalar) >= SVt_PVMG) + { + if (SvSTASH (scalar) == bool_stash) + return 1; - if (!SvOBJECT (scalar) && ref_bool_type (scalar) >= 0) - return 1; + if (!SvOBJECT (scalar) && ref_bool_type (scalar) >= 0) + return 1; + } return 0; } @@ -1689,7 +1691,7 @@ } static SV * -decode_json (SV *string, JSON *json, char **offset_return) +decode_json (SV *string, JSON *json, STRLEN *offset_return) { dec_t dec; SV *sv; @@ -1752,9 +1754,8 @@ sv = decode_sv (&dec); if (offset_return) - *offset_return = dec.cur; - - if (!(offset_return || !sv)) + *offset_return = dec.cur - SvPVX (string); + else if (sv) { // check for trailing garbage decode_ws (&dec); @@ -2111,11 +2112,11 @@ PPCODE: { SV *sv; - char *offset; + STRLEN offset; PUTBACK; sv = decode_json (jsonstr, self, &offset); SPAGAIN; EXTEND (SP, 2); PUSHs (sv); - PUSHs (sv_2mortal (newSVuv (ptr_to_index (jsonstr, offset)))); + PUSHs (sv_2mortal (newSVuv (ptr_to_index (jsonstr, SvPV_nolen (jsonstr) + offset)))); } void incr_parse (JSON *self, SV *jsonstr = 0) @@ -2172,7 +2173,7 @@ do { SV *sv; - char *offset; + STRLEN offset; if (!INCR_DONE (self)) { @@ -2198,11 +2199,11 @@ PUTBACK; sv = decode_json (self->incr_text, self, &offset); SPAGAIN; XPUSHs (sv); - self->incr_pos -= offset - SvPVX (self->incr_text); + self->incr_pos -= offset; self->incr_nest = 0; self->incr_mode = 0; - sv_chop (self->incr_text, offset); + sv_chop (self->incr_text, SvPVX (self->incr_text) + offset); } while (GIMME_V == G_ARRAY); }