/ Check-in [824f9324]
Login

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

Overview
Comment:In dbfuzz2, avoid using a malloc in the LLVMFuzzerInitialize() initializer routine, so that no memory leaks are reported. Also, show the version of SQLite being used when the -v option is on.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 824f93246988ffa213bbd41a7de08886999b1a8ae00fdf6b9767acb6e3ec6a1f
User & Date: drh 2019-01-13 20:23:34
Context
2019-01-14
05:48
Avoid reading off the front of a page buffer when balancing a corrupt btree page. check-in: cb505090 user: drh tags: trunk
2019-01-13
20:23
In dbfuzz2, avoid using a malloc in the LLVMFuzzerInitialize() initializer routine, so that no memory leaks are reported. Also, show the version of SQLite being used when the -v option is on. check-in: 824f9324 user: drh tags: trunk
20:17
Relax the minimum size database file constraint on the dbtotxt utility program. check-in: 97e723d7 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/dbfuzz2.c.

   130    130   
   131    131   /* libFuzzer invokes this routine once when the executable starts, to
   132    132   ** process the command-line arguments.
   133    133   */
   134    134   int LLVMFuzzerInitialize(int *pArgc, char ***pArgv){
   135    135     int i, j, n;
   136    136     int argc = *pArgc;
   137         -  char **newArgv;
   138    137     char **argv = *pArgv;
   139         -  newArgv = malloc( sizeof(char*)*(argc+1) );
   140         -  if( newArgv==0 ) return 0;
   141         -  newArgv[0] = argv[0];
   142    138     for(i=j=1; i<argc; i++){
   143    139       char *z = argv[i];
   144    140       if( z[0]=='-' ){
   145    141         z++;
   146    142         if( z[0]=='-' ) z++;
   147    143         if( z[0]=='v' && (n = numberOfVChar(z))>0 ){
   148    144           eVerbosity += n;
................................................................................
   149    145           continue;
   150    146         }
   151    147         if( strcmp(z,"vdbe-debug")==0 ){
   152    148           bVdbeDebug = 1;
   153    149           continue;
   154    150         }
   155    151       }
   156         -    newArgv[j++] = argv[i];
          152  +    argv[j++] = argv[i];
   157    153     }
   158         -  newArgv[j] = 0;
   159         -  *pArgv = newArgv;
          154  +  argv[j] = 0;
   160    155     *pArgc = j;
   161    156     return 0;
   162    157   }
   163    158   
   164    159   #ifdef STANDALONE
   165    160   /*
   166    161   ** Read an entire file into memory.  Space to hold the file comes
................................................................................
   198    193       int nIn;
   199    194       pIn = readFile(argv[i], &nIn);
   200    195       if( pIn ){
   201    196         LLVMFuzzerTestOneInput((const uint8_t*)pIn, (size_t)nIn);
   202    197         free(pIn);
   203    198       }
   204    199     }
          200  +  if( eVerbosity>0 ){
          201  +    printf("SQLite %s\n", sqlite3_sourceid());
          202  +  }
   205    203     return 0;
   206    204   }
   207    205   #endif /*STANDALONE*/