|
|
Log in / Subscribe / Register

The malicious "rustdecimal" crate

The malicious "rustdecimal" crate

Posted May 11, 2022 20:22 UTC (Wed) by NYKevin (subscriber, #129325)
In reply to: The malicious "rustdecimal" crate by epa
Parent article: The malicious "rustdecimal" crate

The IO monad is not a security mechanism. It is possible to create your own custom variants of unsafePerformIO, like this one in Data.ByteString.Internal: https://hackage.haskell.org/package/bytestring-0.11.3.1/d...

Furthermore, in Haskell's data model, manually allocating memory (which is not the usual case, since Haskell is a high-level language) is considered a side-effect that normally lives within the IO monad, because it alters the state of the heap. This is why the comment linked above complains of "alias[ing] all your buffers" - that particular iteration of unsafePerformIO is subject to inlining, meaning that it will happily inline calls to malloc, which results in Haskell eliminating identical calls and aliasing the resulting buffers.


to post comments


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds