News for hackers. Stuff that matters.
Re:Chromium project finds that 70% of security defects are m... by logicchains on Sunday May 24, 2020 @01:25AM (#23289343)
This can be avoided to some degree by the practice of giving all primitive members a dummy in-class initialiser. E.g. int64_t mSomeIndex=-1;

Sadly I don't think the tooling exists to enforce something like that automatically, because C++ is so hard to parse (a separate issue to memory safety). But when/if metaclasses finally land, it should be possible to write a "fixed" class/struct keyword that default initialises all fields.

Re:Chromium project finds that 70% of security defects are m... by saagarjha on Sunday May 24, 2020 @01:29AM (#23289360)
This was an enum (class) member, so I didn’t really have one to spare that wouldn’t just hide the issue under the rug.
Re:Chromium project finds that 70% of security defects are m... by logicchains on Sunday May 24, 2020 @02:56AM (#23289710)
Ah, that sucks. I don't think there's a solution to that apart from just adding an "Invalid" field to every enum class and initialising to that, but checking for that (asserting not invalid) adds ugly boilerplate to every usage of every enum.
Re:Chromium project finds that 70% of security defects are m... by saagarjha on Sunday May 24, 2020 @03:19AM (#23289791)
Right. Type systems generally don’t like having invalid states at any point, because after all that’s kind of what they do :)