Runtime error: database disk image is malformed (11)
(1.1) By Zhaokun Xiang (silva9988) on 2025-06-11 10:41:51 edited from 1.0 [source]
Dear SQLite Developers,
I meet a Runtime error: database disk image is malformed (11). Please see the below cases. I can reproduce it on the latest Check-in [[e9652e398e]. I would like to express my gratitude to your efforts in bug fixing and detained analysis!
PRAGMA encoding = 'UTF-16';
CREATE VIRTUAL TABLE vt2 USING fts5(c0, c1, tokenize = "porter ascii");
INSERT INTO vt2(c0, c1) VALUES (0.1, NULL);
UPDATE vt2 SET c1=0Xffffffff, c0=6;
UPDATE vt2 SET c1=x'17db';
UPDATE vt2 SET c0=NULL;
INSERT INTO vt2(vt2) VALUES('integrity-check')
-- Runtime error: database disk image is malformed (11)
(2) By jose isaias cabrera (jicman) on 2025-06-11 12:58:35 in reply to 1.1 [link] [source]
Able to replicate it with 3.51.0:
$ ./sqlite3
SQLite version 3.51.0 2025-06-10 18:26:09
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> PRAGMA encoding = 'UTF-16';
sqlite> CREATE VIRTUAL TABLE vt2 USING fts5(c0, c1, tokenize = "porter ascii");
sqlite> INSERT INTO vt2(c0, c1) VALUES (0.1, NULL);
sqlite> UPDATE vt2 SET c1=0Xffffffff, c0=6;
sqlite> UPDATE vt2 SET c1=x'17db';
sqlite> UPDATE vt2 SET c0=NULL;
sqlite> INSERT INTO vt2(vt2) VALUES('integrity-check');
Runtime error: database disk image is malformed (11)
sqlite> .ver
SQLite 3.51.0 2025-06-10 18:26:09 77b79ca1277419b91589aff2c601d4abdd7107d48019a58f7f7c85d96c2a538e
gcc-14.2.0 (64-bit)
(3) By Dan Kennedy (dan) on 2025-06-11 15:24:28 in reply to 1.1 [link] [source]
Thanks for finding and posting this. It was a bug in fts5. Should now be fixed here:
https://sqlite.org/src/info/badf3014bd
Dan.
(4) By jose isaias cabrera (jicman) on 2025-06-11 16:38:14 in reply to 3 [link] [source]
Confirmed fixed in SQLite 3.51.0 2025-06-11 15:03:53:
$ sqlite3
SQLite version 3.51.0 2025-06-11 15:03:53
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> PRAGMA encoding = 'UTF-16';
sqlite> CREATE VIRTUAL TABLE vt2 USING fts5(c0, c1, tokenize = "porter ascii");
sqlite> INSERT INTO vt2(c0, c1) VALUES (0.1, NULL);
sqlite> UPDATE vt2 SET c1=0Xffffffff, c0=6;
sqlite> UPDATE vt2 SET c1=x'17db';
sqlite> UPDATE vt2 SET c0=NULL;
sqlite> INSERT INTO vt2(vt2) VALUES('integrity-check');
sqlite> .ver
SQLite 3.51.0 2025-06-11 15:03:53 badf3014bd1620fd3d4b8013f641fd820b249649fb93cc75b7b8df9dfd6f32a6
gcc-14.2.0 (64-bit)
sqlite>
(5) By Zhaokun Xiang (silva9988) on 2025-06-11 16:47:49 in reply to 3 [link] [source]
Thanks for your fixing!