OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: gcc 4.1 bug miscompiles pointer range checks, may place you at risk

leonleon77hotmail.com
Date: Wed May 03 2006 - 02:21:09 CDT


perhaps instead of "c + len > c" being the test of pointer wraparound, one may use the following (if there is a desire to use pointer-based arithmetic)...

#define MAXPTR (char *)0xffffffff // this would differ on 64 bit systems

if (MAXPTR - c < len)
{
// we have a pointer wraparound...
}