aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bitvec.c3
-rw-r--r--src/pager.c30
-rw-r--r--src/test_config.c8
3 files changed, 22 insertions, 19 deletions
diff --git a/src/bitvec.c b/src/bitvec.c
index be8f4d6d1..c8b8e200b 100644
--- a/src/bitvec.c
+++ b/src/bitvec.c
@@ -32,7 +32,7 @@
** start of a transaction, and is thus usually less than a few thousand,
** but can be as large as 2 billion for a really big database.
**
-** @(#) $Id: bitvec.c,v 1.3 2008/03/21 16:45:47 drh Exp $
+** @(#) $Id: bitvec.c,v 1.4 2008/04/14 01:00:58 drh Exp $
*/
#include "sqliteInt.h"
@@ -130,6 +130,7 @@ int sqlite3BitvecSet(Bitvec *p, u32 i){
u32 h;
assert( p!=0 );
assert( i>0 );
+ assert( i<=p->iSize );
if( p->iSize<=BITVEC_NBIT ){
i--;
p->u.aBitmap[i/8] |= 1 << (i&7);
diff --git a/src/pager.c b/src/pager.c
index e5f3c9799..900f8042c 100644
--- a/src/pager.c
+++ b/src/pager.c
@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
-** @(#) $Id: pager.c,v 1.423 2008/04/03 10:13:01 danielk1977 Exp $
+** @(#) $Id: pager.c,v 1.424 2008/04/14 01:00:58 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
@@ -4434,19 +4434,6 @@ void sqlite3PagerDontWrite(DbPage *pDbPage){
** the PgHdr.needRead flag is set) then this routine acts as a promise
** that we will never need to read the page content in the future.
** so the needRead flag can be cleared at this point.
-**
-** This routine is only called from a single place in the sqlite btree
-** code (when a leaf is removed from the free-list). This allows the
-** following assumptions to be made about pPg:
-**
-** 1. PagerDontWrite() has been called on the page, OR
-** PagerWrite() has not yet been called on the page.
-**
-** 2. The page existed when the transaction was started.
-**
-** Details: DontRollback() (this routine) is only called when a leaf is
-** removed from the free list. DontWrite() is called whenever a page
-** becomes a free-list leaf.
*/
void sqlite3PagerDontRollback(DbPage *pPg){
Pager *pPager = pPg->pPager;
@@ -4464,8 +4451,17 @@ void sqlite3PagerDontRollback(DbPage *pPg){
}
assert( !MEMDB ); /* For a memdb, pPager->journalOpen is always 0 */
- /* Check that PagerWrite() has not yet been called on this page, and
- ** that the page existed when the transaction started.
+#ifdef SQLITE_SECURE_DELETE
+ if( pPg->inJournal || (int)pPg->pgno > pPager->origDbSize ){
+ return;
+ }
+#endif
+
+ /* If SECURE_DELETE is disabled, then there is no way that this
+ ** routine can be called on a page for which sqlite3PagerDontWrite()
+ ** has not been previously called during the same transaction.
+ ** And if DontWrite() has previously been called, the following
+ ** conditions must be met.
*/
assert( !pPg->inJournal && (int)pPg->pgno <= pPager->origDbSize );
@@ -4474,7 +4470,7 @@ void sqlite3PagerDontRollback(DbPage *pPg){
pPg->inJournal = 1;
pPg->needRead = 0;
if( pPager->stmtInUse ){
- assert( pPager->stmtSize <= pPager->origDbSize );
+ assert( pPager->stmtSize >= pPager->origDbSize );
sqlite3BitvecSet(pPager->pInStmt, pPg->pgno);
}
PAGERTRACE3("DONT_ROLLBACK page %d of %d\n", pPg->pgno, PAGERID(pPager));
diff --git a/src/test_config.c b/src/test_config.c
index 1045dcda5..a82f5af11 100644
--- a/src/test_config.c
+++ b/src/test_config.c
@@ -16,7 +16,7 @@
** The focus of this file is providing the TCL testing layer
** access to compile-time constants.
**
-** $Id: test_config.c,v 1.24 2008/03/22 01:07:18 drh Exp $
+** $Id: test_config.c,v 1.25 2008/04/14 01:00:58 drh Exp $
*/
#include "sqliteLimit.h"
@@ -419,6 +419,12 @@ Tcl_SetVar2(interp, "sqlite_options", "long_double",
Tcl_SetVar2(interp, "sqlite_options", "vtab", "1", TCL_GLOBAL_ONLY);
#endif
+#ifdef SQLITE_SECURE_DELETE
+ Tcl_SetVar2(interp, "sqlite_options", "secure_delete", "1", TCL_GLOBAL_ONLY);
+#else
+ Tcl_SetVar2(interp, "sqlite_options", "secure_delete", "0", TCL_GLOBAL_ONLY);
+#endif
+
#define LINKVAR(x) { \
static const int cv_ ## x = SQLITE_ ## x; \
Tcl_LinkVar(interp, "SQLITE_" #x, (char *)&(cv_ ## x), \