aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordan <Dan Kennedy>2021-11-08 15:46:08 +0000
committerdan <Dan Kennedy>2021-11-08 15:46:08 +0000
commit1a39e4561960582d83b84b3fcaf4826e1d9eb8e1 (patch)
treef463d9989032247f15002b008d5937365c4b8ff8 /src
parent6d64b4a0274831766230419bc05fc2ef5e7c1fb1 (diff)
downloadsqlite-1a39e4561960582d83b84b3fcaf4826e1d9eb8e1.tar.gz
sqlite-1a39e4561960582d83b84b3fcaf4826e1d9eb8e1.zip
Fix an assert() in memdbTruncate() that could fail when processing a corrupt database.
FossilOrigin-Name: b1e2929860557cf88f98f0a4f2472e1a16be126bbb8050f0d728350f0cfe987a
Diffstat (limited to 'src')
-rw-r--r--src/memdb.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/memdb.c b/src/memdb.c
index 1cc9fc2e6..31b2324b9 100644
--- a/src/memdb.c
+++ b/src/memdb.c
@@ -331,8 +331,9 @@ static int memdbTruncate(sqlite3_file *pFile, sqlite_int64 size){
MemStore *p = ((MemFile*)pFile)->pStore;
int rc = SQLITE_OK;
memdbEnter(p);
- if( NEVER(size>p->sz) ){
- rc = SQLITE_FULL;
+ if( size>p->sz ){
+ /* This can only happen with a corrupt wal mode db */
+ rc = SQLITE_CORRUPT;
}else{
p->sz = size;
}