[Cryptography] bounded pointers in C

Bear bear at sonic.net
Fri Apr 18 18:58:46 EDT 2014


On Fri, 2014-04-18 at 13:50 -0400, Jerry Leichter wrote:
> On Apr 18, 2014, at 7:35 AM, Ben Laurie <ben at links.org> wrote:
> > Hmm. Any info on how this works (or worked)? All bounded pointers
> > implementations I've seen have required some kind of code annotation
> > to make them work properly (e.g. explicit fat pointers). Can it really
> > be done without source modification?

> In principle, it's easy.  Nothing in C constrains the size of pointers; the compiler can make them any size it likes.  There are statements about what happens if you cast a pointer type to an integer type "large enough to contain it", but nothing says such a type must exist. 

C++11 and later mandate the existence of a type "intptr_t" which is
defined as an integer large enough to hold the value of any pointer.  
You get access to it if you include the stdint library.

In a system with fat pointers intptr_t may be larger than long long
int. 

				Bear








More information about the cryptography mailing list