4 ms·
How did you make struct TerribleArray { int count; int *elements; } correctly bounds check that elements was at least count elements lon
by olliej 3y ago
How did you make
struct TerribleArray {
int count;
int *elements;
}
correctly bounds check that elements was at least count elements long? and that indexing into elements is restricted to 0..<count?
- rwmj 3y agoIt's bounded by the size of the object, eg. the struct. You know this because it was either allocated with malloc or on the stack. There's a paper at the link (one of the most referenced on this topic) which explains everything in detail.