Hi Richard,

         If list of available buffers (*db->lookaside.pFree*)  is NULL and
it is assigned
to pBuf and if you access  pBuf->pNext it will crash. read my comments in
below code
snippet.

            There is good chance that sqlite may end up with empty
lookaside pool(*db->lookaside.pFree*) list when there were many prepare
statements are executed.

please read my comments in code:

if( db->lookaside.bEnabled ){
      if( n>db->lookaside.sz ){
        db->lookaside.anStat[1]++;
      }
*      //pBuf assigned with list of available buffers *
*     else if( (pBuf = db->lookaside.pFree)==0 ){*
        db->lookaside.anStat[2]++;
      }else{
*       //it will crash here and there is no check for NULL here*
*        db->lookaside.pFree = pBuf->pNext;*
        db->lookaside.nOut++;
        db->lookaside.anStat[0]++;
        if( db->lookaside.nOut>db->lookaside.mxOut ){
          db->lookaside.mxOut = db->lookaside.nOut;
        }
        return (void*)pBuf;

Regards,
Ashok


On Tue, Aug 20, 2013 at 7:10 PM, Richard Hipp <d...@sqlite.org> wrote:

> On Tue, Aug 20, 2013 at 9:38 AM, Ashok Pitambar <ashokpitam...@gmail.com
> >wrote:
>
> > Hi All,
> >
> >             I am facing an issue where in sqlite3DbMallocRaw function
> > crashes while trying to access pBuf->pNext. Did anybody came across this
> > issue? any help is appreciated.
> >
>
> This is generally an indication of heap corruption.  Have you run your
> application using valgrind?
>
>
> --
> D. Richard Hipp
> d...@sqlite.org
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to