> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Sunday, July 01, 2007 11:11 AM
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] sqlite testing with Boundschecker
> 
> "Damian Slee" <[EMAIL PROTECTED]> wrote:
> >
> > I have done some testing with 3.2 and now 3.4, visual studio2003 and
> > boundschecker (and XP).
> 
> Thank you for the report.
> 
> I have analyzed the errors reported by boundschecker and they
> all appear to be false postives.  The SQLite 3.4.0 code base
> is correct in all cases and boundchecker is complaining about
> problems that do not exist.
> 
> The following is typical:
> 
> >
> > Dangling Pointer: Pointer 0x010D9250, allocated by HeapAlloc, has
> already
> > been freed.
> >
> > Vdbe.c sqlite3VdbeExec Line 469
> >
> >   if( p->magic!=VDBE_MAGIC_RUN ) return SQLITE_MISUSE;
> >   assert( db->magic==SQLITE_MAGIC_BUSY );
> >   [pTos = p->pTos;]
> >   if( p->rc==SQLITE_NOMEM ){
> >
> 
> There are two pointers on the offending line: "p" and "pTos".  The
> p pointer appears to be valid.  Otherwise, the "return SQLITE_MISUSE"
> two lines above would have be taken.  Or at worst, the dereference
> of p two lines above should have triggered a similar error.  So
> apparently boundschecker is upset because SQLite is merely making
> a copy pointer to previously freed memory.  There really is no
> harm in this.  Nothing bad can happen unless the program actually
> tries to dereference the pointer - which it never does.

BoundsChecker is pedantically correct: code which reads the
value of such an indeterminate pointer has undefined behavior
according to the C standard.  Note that I do mean reading
the value of the pointer, not dereferencing it (which is
more obviously invalid).

As for whether it's worth setting the pointer to null after
the memory to which it pointed is freed, that's subjective.

-- James


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to