Re:Oops It's a kernel stack use-after-free: Exploiting Nvidi...
by tialaramex on Friday October 17, 2025 @05:01AM
(#45614628)
I agree that's an error on my part - Zig does not actually have the billion dollar mistake, although I don't think the approach taken is very good it's clearly not just the billion dollar mistake and so I was wrong to say that.
Re:Oops It's a kernel stack use-after-free: Exploiting Nvidi...
by jibal on Friday October 17, 2025 @10:54PM
(#45624514)
> although I don't think the approach taken is very good
The approach taken is the same as in virtually every other language that has avoided the billion dollar mistake -- null is not a valid pointer value, and instead there's an additional union type (called Optional, Maybe, etc.) that can hold Some(pointer) or None. Zig, like some other languages, extends this union beyond pointers to other types.
The billion dollar mistake is making NULL a valid pointer value, not use after free--which has nothing to do with null pointers and which I didn't comment on, as the comment I responded to only mentioned Zig in regard to the billion dollar mistake. The billion dollar mistake doesn't occur in Zig because null is not a valid value for a pointer, only an optional pointer, which must be unwrapped with an explicit null test.