Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Storable: restricted Storable hashes broken with PERL_PERTURB_KEYS_TOP #115

Open
rurban opened this issue Mar 24, 2016 · 0 comments
Open

Comments

@rurban
Copy link
Member

rurban commented Mar 24, 2016

The restricted flag seems to be gone after some splits, but does reappear.
Not repro with cperl proper hashes. Storable does it's own hash creation.
The failing test regression came with [perl #73972] http://rt.perl.org/Public/Bug/Display.html?id=73972
It describes exactly the same issue.

Fixed in perl5 with commit 11b24ae
Author: Jesse Luehrs [email protected]
Date: Tue Jun 26 16:47:51 2012 -0500

fix off-by-one when restoring hashes [perl #73972]

Storable tries to preallocate enough space for all of the elements it's
going to receive, both for efficiency reasons and because reallocation
triggers throwing away all of the placeholders in the hash (which are
used for restricted hashes) if the hash isn't already READONLY, and
since Storable rebuilds restricted hashes by first populating all of the
placeholders and then setting it READONLY at the end, this would break
things.

Unfortunately, it was allocating just slightly less than enough space -
hashes reallocate when they hit their limit, not when they exceed it,
and so if you tried to store a restricted hash with a number of keys
right on the boundary, it would trigger a reallocation and lose all of
the allowed keys that it had just stored. This fixes the issue by
allocating the correct amount of space to ensure that reallocation
doesn't happen.

I don't consider that a blocking bug.

@rurban rurban added the bug label Mar 24, 2016
@rurban rurban added the ready label Dec 1, 2016
@rurban rurban added in progress and removed ready labels Apr 10, 2018
rurban added a commit that referenced this issue Aug 27, 2018
4.06 2018-08-22 (rurban)
        - Fix overloaded eq/ne comparisons (GH #116 by demerphq, GH #117 by Graham Knopp):
          detect strings, protect from endless recursion. false is now ne "True".
          clarify eq/ne rules in the docs.

4.05 2018-08-19 (rurban)
        - Set decoded type (PR #115 by Pali)
        - Add json_type_weaken (PR #114 by Pali)
        - Fix tests for 5.6 (rurban, pali)

4.04 2018-06-22 (rurban)
        - Fix bignum NaN/inf handling (#78 reported by Slaven Rezic)
        - Move author tests to xt/ as suggested in #106, added a make xtest target.
          Fixes a test fail with ASAN.

4.03 2018-06-21 (rurban)
        - Add sereal cpanel_json_xs type (#110 James Rouzier)
        - Fix bencode/bdecode methods in cpanel_json_xs (#111 Fulvio Scapin)
        - Overload ne operator for JSON::PP::Boolean (#107 tevfik1903)
        - Add a missing semicolon to a documentation example (#104 E. Choroba)

4.02 2018-02-27 (rurban)
        - Add encoder indent_length method (#103 rouzier), previously
          hard-coded to 3.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant