Hello, On Sat, Mar 20, 2010 at 05:32:28PM +0200, Mateusz Kocielski wrote: > (Eg. > > int foo() { char d[10]; int i; i = 5; return d[i] } > > will be translate into: > > int foo() { char d[10]; int i; int _x; i = 5; _x = i; if ( _x < 0 || > _x > 9 ) ERROR(); > return d[_x]; } > )
I've seen some tools that are able to generate bound-checking code for C. There is/was patches for gcc to enable bound-checking and there is some kind program transformator. I do not have the links or names at hand, but I would google the web for such tools, as there exists open source tools that already do such kinds of transformation. Maybe they are outdated or may not compile easily, but they are existent. I think ccured is one of the tools capable of doing such transformations. Btw. someone using ccured on NetBSD? I was very unlucky in compiling it and did not spot it in pkgsrc. Regards Matthias Kretschmer