AI tech bros try to convince us that the slop machines are able to write good code, and that they will be able to inspect it for bugs and vulnerabilities. This is not my experience at all.
Here I have my own implementation of a slab memory allocator in C. Less than 1k LoC, I originally wrote it circa 2012. This is tricky code for a custom data structure with a relatively simple high-level interface - initialise a slab with the desired size of the objects, allocate an object from the slab, free an object from the slab, destroy the whole slab. Behind those seemingly simple operations is a lot of pointer manipulation and chasing, and bit-twiddling.
github.com/bbu/cart/blob/master/slab.h
github.com/bbu/cart/blob/master/slab.c
I am intimately familiar with this code because I wrote it. I know what each branch is supposed to do, and what the expected state of the data structure is in those branches. I asked Gemini to find any bugs and vulnerabilities:
......
...






