SQLite Forum

A testcase causing Assertion `p->nRef>0' failed
Login

A testcase causing Assertion `p->nRef>0' failed

(1) By Jingzhou Fu (fuboat) on 2022-02-28 17:44:43 [source]

System Information:

compile-time options: CC=clang-12 ./configure --enable-debug
sqlite_source_id: 2022-02-28 13:38:28 f2f0426035d4e0334be000a3eb62bbd7d61fdab7c2ef9ba13cfdf6482396dd13
output: sqlite3: sqlite3.c:50948: void sqlite3PcacheMakeDirty(PgHdr *): Assertion `p->nRef>0' failed.

PoC:

CREATE TABLE t1 ( id REAL PRIMARY KEY CHECK( 'For since by man came death,' IS NOT NULL ) );
CREATE TABLE a(b, c, sqlite_stat1 UNIQUE, PRIMARY KEY(b, c)) WITHOUT ROWID;
INSERT INTO a VALUES('abc', zeroblob(74573), 'xyz');
PRAGMA integrity_check;
INSERT INTO a VALUES('abc2', zeroblob(205), 'xyz2');
PRAGMA writable_schema = 1;
SELECT sqlsim10 FROM sqlsim12 WHERE sqlsim11=='abc';
UPDATE sqlite_master SET rootpage=5 WHERE tbl_name = 'a';
PRAGMA writable_schema=ON;
CREATE VIRTUAL TABLE v4 USING zipfile ( v5 , v6 REAL ) ;
UPDATE a SET sqlite_stat1=sqlite_stat1||'6';
PRAGMA reverse_unordered_selects = ON;
PRAGMA foreign_keys;
COMMIT;
UPDATE a SET b=b||'1';
UPDATE a SET sqlite_stat1=sqlite_stat1||'2';

(2) By Jingzhou Fu (fuboat) on 2022-02-28 17:52:09 in reply to 1 [link] [source]

These four assertions failed posted in recent threads are all of what were discovered by the fuzzer during recent two months. No crash was found in release version.

(3) By Richard Hipp (drh) on 2022-03-01 15:53:44 in reply to 1 [link] [source]

Now fixed on trunk. This was just some slightly-incorrect assert() statements.