SQLite files can sometimes become corrupted if the application crashes at the wrong time.
When this problem occurs, all queries fail with “disk image is malformed” or SQLITE_CORRUPT.
In this situation, you can try to dump and recreate the database using the following commands:
sqlite3 FileName.sqlite .output Dump.sql .dump .exit
sqlite3 Repaired.sqlite .read Dump.sql .exit