New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tie
then untie
on a hash that is midway through iteration mangles the hash iterator state
#19077
Comments
nwc10
added a commit
to nwc10/perl5
that referenced
this issue
Aug 23, 2021
Previously it would mangle it, resetting EITER but not RITER, meaning that after untie continuing iteration would be inconsistent - normally it would carry on exactly where it left off, but if iteration had been in the middle of a chain of HEs, it would skip the rest of the chain. Fixes GH Perl#19077
nwc10
added a commit
to nwc10/perl5
that referenced
this issue
Aug 23, 2021
Previously it would mangle it, resetting EITER but not RITER, meaning that after untie continuing iteration would be inconsistent - normally it would carry on exactly where it left off, but if iteration had been in the middle of a chain of HEs, it would skip the rest of the chain. Fixes GH Perl#19077
nwc10
added a commit
to nwc10/perl5
that referenced
this issue
Aug 24, 2021
Previously it would mangle it, resetting EITER but not RITER, meaning that after untie continuing iteration would be inconsistent - normally it would carry on exactly where it left off, but if iteration had been in the middle of a chain of HEs, it would skip the rest of the chain. Fixes GH Perl#19077
tonycoz
pushed a commit
that referenced
this issue
Aug 25, 2021
Previously it would mangle it, resetting EITER but not RITER, meaning that after untie continuing iteration would be inconsistent - normally it would carry on exactly where it left off, but if iteration had been in the middle of a chain of HEs, it would skip the rest of the chain. Fixes GH #19077
Fixed by 364906c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
tie
thenuntie
on a hash that is midway through iteration mangles the hash iterator state. After theuntie
where hash iteration resumes is not consistent, and depends on whethertie
chanced to happen when the iterator was midway down a hash chain.Steps to Reproduce
(Note that for this run
A
andF
were the first pair of keys that were found to collide into the same hash chain, and (fortunately)A
andB
did not collide)Expected behaviour
Expected behaviour would be "something consistent" - whether the keys collide or not the state is the same.
The bug is in this code in
pp_tie
:which (re)sets
EITER
but notRITER
when the hash is tied, meaning thatRITER
is unchanged.Fix coming once I have an issue ID.
The text was updated successfully, but these errors were encountered: