-
Notifications
You must be signed in to change notification settings - Fork 560
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
Hash::Util::FieldHash: bad use of MAGIC #22961
Comments
Additionally, it has a possible memory leak in That said, that entire blob of code is doing very questionably-dodgy things anyway. It appears the code is just used at |
I'd call this old-fashioned instead of bad. This used to be something of an idiom (especially before 5.14 introduced
Ouch. Yeah Then again everything about how this module is using magic is messy. The whole uvar on hashes thing was specifically added to core for this module, and yet it still sucks to the point of being barely usable (mainly because it doesn't offer a way to add state to the callbacks, so they need a second magic lookup for state. The quality control when this was added in 5.10 was not where it should have been. |
While reading though some existing uses of
PERL_MAGIC_ext
to consider conversion into Hooks, I found that whatFieldHash.xs
does is not good. It usesext
magic with no vtable at all, instead relying on an unlikely value of0x4944
stored in themg_private
field in the hope of uniquely identifying its own tagging.Really, this should be done with a unique (
static const
) vtable, like other modules do.The text was updated successfully, but these errors were encountered: