/ Check-in [021e8874]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix the fuzzcheck program so that it can create new databases again.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 021e8874a7d1bb94debae3ae04f83056a8573148ffc872cd76a186a2d22d0296
User & Date: drh 2017-03-20 20:42:21
Context
2017-03-20
22:58
Add the --native-malloc option to fuzzcheck. Fix ossfuzz.c and fuzzcheck.c so that they both deallocate the temp_store_directory before closing. check-in: 0dd18ec8 user: drh tags: trunk
20:42
Fix the fuzzcheck program so that it can create new databases again. check-in: 021e8874 user: drh tags: trunk
19:35
Avoid passing NULL as the second argument to memcpy() in fts3. check-in: 49b93d97 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/fuzzcheck.c.

   968    968         fatalError("cannot import into more than one database");
   969    969       }
   970    970     }
   971    971   
   972    972     /* Process each source database separately */
   973    973     for(iSrcDb=0; iSrcDb<nSrcDb; iSrcDb++){
   974    974       rc = sqlite3_open_v2(azSrcDb[iSrcDb], &db,
   975         -                         SQLITE_OPEN_READONLY, pDfltVfs->zName);
          975  +                         SQLITE_OPEN_READWRITE, pDfltVfs->zName);
   976    976       if( rc ){
   977    977         fatalError("cannot open source database %s - %s",
   978    978         azSrcDb[iSrcDb], sqlite3_errmsg(db));
   979    979       }
   980    980       rc = sqlite3_exec(db,
   981    981          "CREATE TABLE IF NOT EXISTS db(\n"
   982    982          "  dbid INTEGER PRIMARY KEY, -- database id\n"
................................................................................
  1043   1043         sqlite3_finalize(pStmt);
  1044   1044         rc = sqlite3_exec(db, "COMMIT", 0, 0, 0);
  1045   1045         if( rc ) fatalError("cannot commit the transaction: %s", sqlite3_errmsg(db));
  1046   1046         rebuild_database(db);
  1047   1047         sqlite3_close(db);
  1048   1048         return 0;
  1049   1049       }
         1050  +    rc = sqlite3_exec(db, "PRAGMA query_only=1;", 0, 0, 0);
         1051  +    if( rc ) fatalError("cannot set database to query-only");
  1050   1052       if( zExpDb!=0 || zExpSql!=0 ){
  1051   1053         sqlite3_create_function(db, "writefile", 2, SQLITE_UTF8, 0,
  1052   1054                                 writefileFunc, 0, 0);
  1053   1055         if( zExpDb!=0 ){
  1054   1056           const char *zExDb = 
  1055   1057             "SELECT writefile(printf('%s/db%06d.db',?1,dbid),dbcontent),"
  1056   1058             "       dbid, printf('%s/db%06d.db',?1,dbid), length(dbcontent)"