Up until [check-in f7ab01f2](https://sqlite.org/src/timeline?c=f7ab01f254cd9d70), the following program would work: ``` #include <sqlite3.h> #include <assert.h> #include <string.h> #include <stdio.h> int main() { sqlite3 *db; sqlite3_stmt *stmt; int rc; rc = sqlite3_open(":memory:", &db); assert(rc == SQLITE_OK); const char* sql = "SELECT 0 WHERE 0;"; rc = sqlite3_prepare_v2(db, sql, strlen(sql), &stmt, 0); assert(rc == SQLITE_OK); rc = sqlite3_finalize(stmt); assert(rc == SQLITE_OK); rc = sqlite3_step(stmt); assert(rc == SQLITE_MISUSE); rc = sqlite3_close(db); assert(rc == SQLITE_OK); printf("All good!\n"); return 0; } ``` Calling `sqlite3_step` on a finalized statement returned `SQLITE_MISUSE`, which seems sensible and matches the (current) documentation of `sqlite3_step`: ``` ** [SQLITE_MISUSE] means that the this routine was called inappropriately. ** Perhaps it was called on a [prepared statement] that has ** already been [sqlite3_finalize | finalized] ``` Then, in [check-in 52a12e47](https://sqlite.org/src/timeline?c=52a12e47de887441), the default lookaside configuration was changed and that program crashes with a segmentation fault, which matches the (current) documentation of `sqlite3_finalize`: ``` ** It is a grievous error for the application to try to use ** a prepared statement after it has been finalized. Any use of a prepared ** statement after it has been finalized can result in undefined and ** undesirable behavior such as segfaults and heap corruption. ``` So what is the expected behavior? If the documentation of `sqlite3_finalize` holds the truth, then the documentation of `sqlite3_step` deserves an update to avoid confusion. Also, is there any case where using a prepared statement that has been finalized doesn't crash?