This code in interop.c needs a null check on p before it accesses p->magic.

__declspec(dllexport) int WINAPI sqlite3_finalize_interop(sqlite3_stmt *stmt)
{
  Vdbe *p;
  sqlite3 *db;
  int ret;

  p = (Vdbe *)stmt;
  db = (p == NULL) ? NULL : p->db;

  if (p->magic == VDBE_MAGIC_DEAD)
  {
    if (db == NULL)
    {
      sqlite3_free(p);
      ret = SQLITE_OK;
    }
  }
  else
    ret = sqlite3_finalize(stmt);

  return ret;
}

Added null check.  Check-in [726d3115f6] .