BugTraq
gcc 4.1 bug miscompiles pointer range checks, may place you at risk Apr 17 2006 08:03PM
Felix von Leitner (felix-bugtraq fefe de) (6 replies)
Re: gcc 4.1 bug miscompiles pointer range checks, may place you at risk Apr 18 2006 07:16PM
Florian Weimer (fw deneb enyo de)
Re: gcc 4.1 bug miscompiles pointer range checks, may place you at risk Apr 18 2006 09:21AM
Gabor Gombas (gombasg sztaki hu)
On Mon, Apr 17, 2006 at 10:03:54PM +0200, Felix von Leitner wrote:

> static inline int range_ptrinbuf(const void* buf,unsigned long len,const void* ptr) {
> register const char* c=(const char*)buf; /* no pointer arithmetic on void* */
> return (c && c+len>c && (const char*)ptr-c<len);
> }

$ gcc-4.1 -W -Wall t.c
t.c:5: warning: comparison between signed and unsigned

> gcc 3 compiles this code correctly. I tested this on x86 and amd64.
> I mention this here because "c+len>c" is the code with which you would
> typically check for integer overflows, which is a check that for example
> an IP stack would do, or Samba.

AFAIK C99 states that the value of that expression is "undefined". So
IMHO this is an application bug, not a bug in gcc.

Gabor

--
---------------------------------------------------------
MTA SZTAKI Computer and Automation Research Institute
Hungarian Academy of Sciences
---------------------------------------------------------

[ reply ]
Re: gcc 4.1 bug miscompiles pointer range checks, may place you at risk Apr 18 2006 07:45AM
Alexander Klimov (alserkli inbox ru)
Re: gcc 4.1 bug miscompiles pointer range checks, may place you at risk Apr 18 2006 12:15AM
Nate Eldredge (nge cs hmc edu)
Re: gcc 4.1 bug miscompiles pointer range checks, may place you at risk Apr 17 2006 11:57PM
Michael Chamberlain (michael chamberlain net au)
Re: gcc 4.1 bug miscompiles pointer range checks, may place you at risk Apr 17 2006 10:26PM
Forrest J. Cavalier III (mibsoft mibsoftware com)


 

Privacy Statement
Copyright 2010, SecurityFocus