summaryrefslogtreecommitdiff
path: root/systems/texlive/tlnet/tlpkg/tlperl/site/lib/Cpanel/JSON/XS.pm
diff options
context:
space:
mode:
Diffstat (limited to 'systems/texlive/tlnet/tlpkg/tlperl/site/lib/Cpanel/JSON/XS.pm')
-rwxr-xr-xsystems/texlive/tlnet/tlpkg/tlperl/site/lib/Cpanel/JSON/XS.pm66
1 files changed, 52 insertions, 14 deletions
diff --git a/systems/texlive/tlnet/tlpkg/tlperl/site/lib/Cpanel/JSON/XS.pm b/systems/texlive/tlnet/tlpkg/tlperl/site/lib/Cpanel/JSON/XS.pm
index 49f15fcee2..887285846f 100755
--- a/systems/texlive/tlnet/tlpkg/tlperl/site/lib/Cpanel/JSON/XS.pm
+++ b/systems/texlive/tlnet/tlpkg/tlperl/site/lib/Cpanel/JSON/XS.pm
@@ -1,5 +1,5 @@
package Cpanel::JSON::XS;
-our $VERSION = '4.27';
+our $VERSION = '4.37';
our $XS_VERSION = $VERSION;
# $VERSION = eval $VERSION;
@@ -112,7 +112,10 @@ or L<https://rt.cpan.org/Public/Dist/Display.html?Queue=Cpanel-JSON-XS>
B<Changes to JSON::XS>
+- bare hashkeys are now checked for utf8. (GH #209)
+
- stricter decode_json() as documented. non-refs are disallowed.
+ safe by default.
added a 2nd optional argument. decode() honors now allow_nonref.
- fixed encode of numbers for dual-vars. Different string
@@ -157,8 +160,14 @@ B<Changes to JSON::XS>
- relaxed mode, allowing many popular extensions
+- protect our magic object from corruption by wrong or missing external
+ methods, like FREEZE/THAW or serialization with other methods.
+
- additional fixes for:
+ - #208 - no security-relevant out-of-bounds reading of module memory
+ when decoding hash keys without ending ':'
+
- [cpan #88061] AIX atof without USE_LONG_DOUBLE
- #10 unshare_hek crash
@@ -180,6 +189,8 @@ B<Changes to JSON::XS>
- #167 sort tied hashes with canonical.
+ - #212 fix utf8 object stringification
+
- public maintenance and bugtracker
- use ppport.h, sanify XS.xs comment styles, harness C coding style
@@ -187,15 +198,15 @@ B<Changes to JSON::XS>
- common::sense is optional. When available it is not used in the
published production module, just during development and testing.
-- extended testsuite, passes all http://seriot.ch/parsing_json.html
+- extended testsuite, passes all http://seriot.ch/projects/parsing_json.html
tests. In fact it is the only know JSON decoder which does so,
while also being the fastest.
- support many more options and methods from JSON::PP:
stringify_infnan, allow_unknown, allow_stringify, allow_barekey,
- encode_stringify, allow_bignum, allow_singlequote, sort_by
- (partially), escape_slash, convert_blessed, ... optional
- decode_json(, allow_nonref) arg.
+ encode_stringify, allow_bignum, allow_singlequote, dupkeys_as_arrayref,
+ sort_by (partially), escape_slash, convert_blessed, ...
+ optional decode_json(, allow_nonref) arg.
relaxed implements allow_dupkeys.
- support all 5 unicode L<BOM|/BOM>'s: UTF-8, UTF-16LE, UTF-16BE, UTF-32LE,
@@ -659,13 +670,12 @@ L</allow_barekey> option.
=item * allow_dupkeys
Allow decoding of duplicate keys in hashes. By default duplicate keys are forbidden.
-See L<http://seriot.ch/parsing_json.php#24>:
+See L<http://seriot.ch/projects/parsing_json.php#24>:
RFC 7159 section 4: "The names within an object should be unique."
-See the L</allow_dupkeys> option.
+See the C<allow_dupkeys> option.
=back
-
=item $json = $json->canonical ([$enable])
=item $enabled = $json->get_canonical
@@ -880,9 +890,29 @@ disable it, however with Perl hashes they are impossible, parsing
JSON in Perl silently ignores duplicate names, using the last value
found.
-See L<http://seriot.ch/parsing_json.php#24>:
+See L<http://seriot.ch/projects/parsing_json.php#24>:
RFC 7159 section 4: "The names within an object should be unique."
+=item $json = $json->dupkeys_as_arrayref ([$enable])
+
+=item $enabled = $json->get_dupkeys_as_arrayref
+
+If enabled, allow decoding of duplicate keys in hashes and store the
+values as arrayref in the hash instead. By default duplicate keys are
+forbidden. Enabling this also enables the L</allow_dupkeys> option,
+but disabling this does not disable the L</allow_dupkeys> option.
+
+Example:
+
+ $json->dupkeys_as_arrayref;
+ print encode_json ($json->decode ('{"a":"b","a":"c"}'));
+
+ => {"a":["b","c"]}
+
+This changes the result structure, thus cannot be enabled by default.
+The client must be aware of it. The resulting arrayref is not yet marked somehow
+(blessed or such).
+
=item $json = $json->allow_blessed ([$enable])
=item $enabled = $json->get_allow_blessed
@@ -2063,7 +2093,7 @@ output (modulo bugs, but C<JSON::XS> has found more bugs in the
official JSON testsuite (1) than the official JSON testsuite has found
in C<JSON::XS> (0)).
C<Cpanel::JSON::XS> is currently the only known JSON decoder which passes all
-L<http://seriot.ch/parsing_json.html> tests, while being the fastest also.
+L<http://seriot.ch/projects/parsing_json.html> tests, while being the fastest also.
When you have trouble decoding JSON generated by this module using other
decoders, then it is very likely that you have an encoding mismatch or the
@@ -2315,10 +2345,18 @@ BEGIN {
require overload;
local $^W; # silence redefine warnings. no warnings 'redefine' does not help
- &overload::import( 'overload', # workaround 5.6 reserved keyword warning
- "0+" => sub { ${$_[0]} },
- "++" => sub { $_[0] = ${$_[0]} + 1 },
- "--" => sub { $_[0] = ${$_[0]} - 1 },
+ # These already come with JSON::PP::Boolean. Avoid redefine warning.
+ if (!defined $JSON::PP::Boolean::VERSION or $JSON::PP::VERSION lt '4.00') {
+ &overload::unimport( 'overload', '0+', '++', '--' );
+ &overload::import( 'overload',
+ "0+" => sub { ${$_[0]} },
+ "++" => sub { $_[0] = ${$_[0]} + 1 },
+ "--" => sub { $_[0] = ${$_[0]} - 1 },
+ );
+ }
+ # workaround 5.6 reserved keyword warning
+ &overload::unimport( 'overload', '""', 'eq', 'ne' );
+ &overload::import( 'overload',
'""' => sub { ${$_[0]} == 1 ? '1' : '0' }, # GH 29
'eq' => sub {
my ($obj, $op) = $_[2] ? ($_[1], $_[0]) : ($_[0], $_[1]);