/ Check-in [2e6f7c2a]
Login

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

Overview
Comment:In fuzzcheck, activate vdbe_debug for dbsqlfuzz cases when using the -vvvvv verbosity level or above.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dbsqlfuzz-in-fuzzcheck
Files: files | file ages | folders
SHA3-256: 2e6f7c2aced49824a38b3494b796a8ec73aa7a90b51159f670596df15ed1c5ab
User & Date: drh 2019-01-25 13:03:38
Context
2019-01-25
14:16
Fix the xFetch method of the "memdb" VFS (used by deserialize) so that it is robust against corrupt database file. Closed-Leaf check-in: 2c1ef40e user: drh tags: dbsqlfuzz-in-fuzzcheck
13:03
In fuzzcheck, activate vdbe_debug for dbsqlfuzz cases when using the -vvvvv verbosity level or above. check-in: 2e6f7c2a user: drh tags: dbsqlfuzz-in-fuzzcheck
04:43
Improved automatic detection of dbsqlfuzz cases in fuzzcheck. check-in: 1ef24e89 user: drh tags: dbsqlfuzz-in-fuzzcheck
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/fuzzcheck.c.

   788    788       fprintf(stderr, "sqlite3_deserialize() failed with %d\n", rc);
   789    789       goto testrun_finished;
   790    790     }
   791    791     if( maxDbSize>0 ){
   792    792       sqlite3_int64 x = maxDbSize;
   793    793       sqlite3_file_control(cx.db, "main", SQLITE_FCNTL_SIZE_LIMIT, &x);
   794    794     }
          795  +
          796  +  /* For high debugging levels, turn on debug mode */
          797  +  if( eVerbosity>=5 ){
          798  +    sqlite3_exec(cx.db, "PRAGMA vdbe_debug=ON;", 0, 0, 0);
          799  +  }
   795    800   
   796    801     /* Block debug pragmas and ATTACH/DETACH.  But wait until after
   797    802     ** deserialize to do this because deserialize depends on ATTACH */
   798    803     sqlite3_set_authorizer(cx.db, block_troublesome_sql, 0);
   799    804   
   800    805     /* Consistent PRNG seed */
   801    806     sqlite3_randomness(0,0);
................................................................................
  1237   1242         v *= aMult[i].iMult;
  1238   1243         break;
  1239   1244       }
  1240   1245     }
  1241   1246     if( v>0x7fffffff ) fatalError("parameter too large - max 2147483648");
  1242   1247     return (int)(isNeg? -v : v);
  1243   1248   }
         1249  +
         1250  +/*
         1251  +** Return the number of "v" characters in a string.  Return 0 if there
         1252  +** are any characters in the string other than "v".
         1253  +*/
         1254  +static int numberOfVChar(const char *z){
         1255  +  int N = 0;
         1256  +  while( z[0] && z[0]=='v' ){
         1257  +    z++;
         1258  +    N++;
         1259  +  }
         1260  +  return z[0]==0 ? N : 0;
         1261  +}
  1244   1262   
  1245   1263   /*
  1246   1264   ** Print sketchy documentation for this utility program
  1247   1265   */
  1248   1266   static void showHelp(void){
  1249   1267     printf("Usage: %s [options] SOURCE-DB ?ARGS...?\n", g.zArgv0);
  1250   1268     printf(
................................................................................
  1311   1329     char *zExpSql = 0;           /* Write SQL to files in this directory */
  1312   1330     void *pHeap = 0;             /* Heap for use by SQLite */
  1313   1331     int ossFuzz = 0;             /* enable OSS-FUZZ testing */
  1314   1332     int ossFuzzThisDb = 0;       /* ossFuzz value for this particular database */
  1315   1333     int nativeMalloc = 0;        /* Turn off MEMSYS3/5 and lookaside if true */
  1316   1334     sqlite3_vfs *pDfltVfs;       /* The default VFS */
  1317   1335     int openFlags4Data;          /* Flags for sqlite3_open_v2() */
         1336  +  int nV;                      /* How much to increase verbosity with -vvvv */
  1318   1337   
  1319   1338     sqlite3_initialize();
  1320   1339     iBegin = timeOfDay();
  1321   1340   #ifdef __unix__
  1322   1341     signal(SIGALRM, timeoutHandler);
  1323   1342   #endif
  1324   1343     g.zArgv0 = argv[0];
................................................................................
  1417   1436         }else
  1418   1437         if( strcmp(z,"timeout-test")==0 ){
  1419   1438           timeoutTest = 1;
  1420   1439   #ifndef __unix__
  1421   1440           fatalError("timeout is not available on non-unix systems");
  1422   1441   #endif
  1423   1442         }else
  1424         -      if( strcmp(z,"verbose")==0 || strcmp(z,"v")==0 ){
         1443  +      if( strcmp(z,"verbose")==0 ){
  1425   1444           quietFlag = 0;
  1426   1445           verboseFlag++;
  1427   1446           eVerbosity++;
  1428   1447           if( verboseFlag>1 ) runFlags |= SQL_TRACE;
  1429   1448         }else
         1449  +      if( (nV = numberOfVChar(z))>=1 ){
         1450  +        quietFlag = 0;
         1451  +        verboseFlag += nV;
         1452  +        eVerbosity += nV;
         1453  +        if( verboseFlag>1 ) runFlags |= SQL_TRACE;
         1454  +      }else
  1430   1455         if( strcmp(z,"version")==0 ){
  1431   1456           int ii;
  1432   1457           const char *z;
  1433   1458           printf("SQLite %s %s\n", sqlite3_libversion(), sqlite3_sourceid());
  1434   1459           for(ii=0; (z = sqlite3_compileoption_get(ii))!=0; ii++){
  1435   1460             printf("%s\n", z);
  1436   1461           }