4 ms·
Rediscovering memory unsafety through performance chasing. Ah well.
by barrkel 3y ago
Rediscovering memory unsafety through performance chasing. Ah well.
- JBiserkov 3y agoIndeed! > the use of DataView here was an optimization that, though intended to speed things up, actually slowed things down … and broke them utterly in the process.
- munchler 3y agoSeriously. Any design that encourages aliasing of mutable memory like this is just asking for trouble. This is a lesson that the functional programming community has already internalized, but the rest of the world sadly has not.
- MBCook 3y agoReading about that and the JS runtime just handing out a view into a shared mutable buffer just floored me. That’s so clear dangerous from both a bug and security perspective.
- jjnoakes 3y ago> That 16-bit payload length is actually written somewhere else, as bytes 3 and 4 of Buffer.allocUnsafe()’s global pool. These bytes may well be part of another active buffer, and thus we also stand a good chance of corrupting data elsewhere. No kidding.