Open p5pRT opened 8 years ago
$ cat example.pl my $hash = { a => {}\, b => {} }; for my $value ( values %$hash ) { delete $hash->{ b }; print $value; #\<\<\<\<\< Use of freed value in iteration at ... }
$ perl example.pl Use of freed value in iteration at iter_free line 4. HASH(0x1590178) $ perl example.pl HASH(0x17e6d38)HASH(0x17d1178)
That is not expected to get different behavior for two runs
Maybe related to: https://rt.perl.org/Public/Bug/Display.html?id=85026 which was closed as of 5.14.1 https://metacpan.org/pod/distribution/perl/pod/perl5141delta.pod#Bug-Fixes * A bug has been fixed that would cause a "Use of freed value in iteration" error if the next two hash elements that would be iterated over are deleted. [perl #85026]
https://rt.perl.org/Public/Bug/Display.html?id=89548 https://rt.perl.org/Public/Bug/Display.html?id=77706
On Sat Jul 16 10:00:14 2016\, kes-kes@yandex.ru wrote:
$ cat example.pl my $hash = { a => {}\, b => {} }; for my $value ( values %$hash ) { delete $hash->{ b }; print $value; #\<\<\<\<\< Use of freed value in iteration at ... }
$ perl example.pl Use of freed value in iteration at iter_free line 4. HASH(0x1590178) $ perl example.pl HASH(0x17e6d38)HASH(0x17d1178)
That is not expected to get different behavior for two runs
Maybe related to: https://rt.perl.org/Public/Bug/Display.html?id=85026 which was closed as of 5.14.1 https://metacpan.org/pod/distribution/perl/pod/perl5141delta.pod#Bug- Fixes * A bug has been fixed that would cause a "Use of freed value in iteration" error if the next two hash elements that would be iterated over are deleted. [perl #85026]
No\, itâs not related to that.
https://rt.perl.org/Public/Bug/Display.html?id=89548 https://rt.perl.org/Public/Bug/Display.html?id=77706
Thatâs exactly it. The stack holds no reference counts and âdelete $hash->{b}â frees one of the return values of âvaluesâ which is on the stack on items that âforâ is iterating through.
--
Father Chrysostomos
The RT System itself - Status changed from 'new' to 'open'
Migrated from rt.perl.org#128634 (status was 'open')
Searchable as RT128634$