Hi Richard,

Thanks for your quick response!  The call stack at the point when the 
SQLITE_CORRUPT_BKPT occurs looks like this:

sqlite3VdbeExec
   case OP_OpenWrite:
sqlite3BtreeCursor
btreeCursor
getAndInitPage
sqlite3BtreeGetPage
sqlite3PagerAcquire
pagerAcquire

It appears that the invalid page is operand p2 of an OpenWrite op.  It almost 
seems as if the prepared statement is already faulty, is that possible?

-Albert

-----Original Message-----
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of D. Richard Hipp
Sent: Thursday, March 19, 2009 5:48 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Strange SQLITE_CORRUPT error


On Mar 19, 2009, at 8:33 PM, Kim, Albert wrote:
>
> /* The maximum page number is 2^31. Return SQLITE_CORRUPT if a page
> ** number greater than this, or zero, is requested.
> */
> if( pgno>PAGER_MAX_PGNO || pgno==0 || pgno==PAGER_MJ_PGNO(pPager) ){
>   return SQLITE_CORRUPT_BKPT;                      <<<<<<<<<<<<<HERE
> }
>
>
> With some debug printfs I was able to see that pgno is -1 at this  
> point!


pgno is an unsigned integer, so the value is really 4294967295.  That  
number is greater than PAGER_MAX_PGNO, which is what is causing the  
SQLITE_CORRUPT to be returned.

If you can figure out who is calling pagerAcquire() with the faulty  
page number, that would be helpful.

D. Richard Hipp
d...@hwaci.com



_______________________________________________
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