4 ms·
Been there! https://www.doc.ic.ac.uk/~phjk/BoundsChecking.html https://www.doc.ic.ac.uk/~phjk/BoundsChecking.html (adding gcc -fbounds-checking, in 1995). We d
by rwmj 3y ago
Been there! https://www.doc.ic.ac.uk/~phjk/BoundsChecking.html https://www.doc.ic.ac.uk/~phjk/BoundsChecking.html (adding gcc -fbounds-checking, in 1995). We didn't need special annotations.
- olliej 3y agoHow 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.