Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove duplicate update of iter in Perl_hv_iternext_flags().
Because`iter` points to a structure immediately after of HvARRAY(), it needs updating if HvARRAY() has moved because it has been expanded. Code was added for VMS in Aug 2005 to address a specific instance of this bug with commit 03026e6: [patch@25334] hv.c vms environment fix. From: "John E. Malmberg" <wb8tyw@qsl.net> Message-ID: <4310F552.8050401@qsl.net> see https://www.nntp.perl.org/group/perl.perl5.porters/2005/08/msg104261.html However, this code was duplicated by and hence made redundant with a more general fix added in March 2014 by commit 339441e: make core safe against HvAUX() realloc Since the HvAUX structure is just tacked onto the end of the HvARRAY() struct, code like this can do bad things: aux = HvAUX(); ... something that might split hv ... aux->foo = ...; /* SEGV! */ So I've visually audited core for places where HbAUX() is saved and then re-used, and re-initialised the var if it looks like HvARRAY() could have changed in the meantime. I've been very conservative about what might be unsafe. For example, destructors or __WARN__ handlers could call perl code that modifies the hash. Hence remove the redundant code.
- Loading branch information