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

protect hash iter with a changed hash #117

Closed
rurban opened this issue Mar 27, 2016 · 2 comments
Closed

protect hash iter with a changed hash #117

rurban opened this issue Mar 27, 2016 · 2 comments
Assignees
Milestone

Comments

@rurban
Copy link
Member

rurban commented Mar 27, 2016

When iterating over a hash, check if the hash structure was changed while iterating over it (by side effect or a thread).
Disallow any changes to hash keys while iterating over them.
=> error "Attempt to change hash while iterating over it"

Internally uses HvAUX timestamp fields, bumped on each change. This is safer than the last_rand field.

Add a new use hashiter pragma to allow changes as previously while iterating over the hash.

Originally I even forbid changing values. For now we disallow insert and deletion, even with deferred LAZYDEL.
Need to test many CPAN modules, and provide distroprefs patches.

Note: This was CM-663

@rurban rurban self-assigned this Mar 27, 2016
@rurban rurban added the bug label Mar 27, 2016
rurban pushed a commit that referenced this issue Mar 27, 2016
Disallow any changes to hashes while iterating over them.
=> Attempt to change hash while iterating over it

Implements GH #117
@rurban rurban added enhancement and removed bug labels Mar 27, 2016
@rurban
Copy link
Member Author

rurban commented Mar 29, 2016

Passes almost all CPAN tests.
Failing modules:

  • RJBS/Email-MIME-Kit-3.000002
  • ETHER/Moose-2.1605 Class::MOP::Mixin::HasMethods::mop_update_method_map()

rurban pushed a commit that referenced this issue Feb 4, 2018
Disallow any changes to hashes while iterating over them.
=> Attempt to change hash while iterating over it

Implements GH #117
rurban pushed a commit that referenced this issue Feb 4, 2018
We now generally disallow destructive iterators,
adding or removing a key during iteration.
But we do allow changing a value.

Get the old unrecommended behavior with use hashiter.
See GH #117.

WIP. crashes in Zlib: return inflateResetKeep(strm)
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.
rurban pushed a commit that referenced this issue Sep 13, 2018
Disallow any changes to hashes while iterating over them.
=> Attempt to change hash while iterating over it

Implements GH #117
rurban pushed a commit that referenced this issue Sep 13, 2018
We now generally disallow destructive iterators,
adding or removing a key during iteration.
But we do allow changing a value.

Get the old unrecommended behavior with use hashiter.
See GH #117.

WIP. crashes in Zlib: return inflateResetKeep(strm)
@rurban
Copy link
Member Author

rurban commented Sep 14, 2018

Merged into 5.29.0c

@rurban rurban added this to the v5.29.0c milestone Sep 14, 2018
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