SQLite

Check-in [c71098409c]
Login

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

Overview
Comment:Fixes to the PRNG_SEED pragma idea.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | prng-seed-test-control
Files: files | file ages | folders
SHA3-256: c71098409c98af8360f8f28b9238a12ec764018a5782e8ff03fdf5db54031d6e
User & Date: drh 2019-08-02 21:03:24.230
Context
2019-08-03
01:39
Give the SQLITE_TESTCTRL_PRNG_SEED two arguments. The second argument if not NULL is a pointer to a database connection which seeds the connection from its schema cookie. In this way, fuzzers can control the PRNG seed. (Closed-Leaf check-in: 49aa344806 user: drh tags: prng-seed-test-control)
2019-08-02
21:03
Fixes to the PRNG_SEED pragma idea. (check-in: c71098409c user: drh tags: prng-seed-test-control)
20:45
Add the SQLITE_TESTCTRL_PRNG_SEED test control. (check-in: 3ac5723164 user: drh tags: prng-seed-test-control)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/test1.c.
6388
6389
6390
6391
6392
6393
6394
6395

6396
6397
6398
6399
6400
6401
6402
6388
6389
6390
6391
6392
6393
6394

6395
6396
6397
6398
6399
6400
6401
6402







-
+







  Tcl_Obj *CONST objv[]  /* Command arguments */
){
  unsigned int i;
  if( objc!=2 ){
    Tcl_WrongNumArgs(interp, 1, objv, "PRNG-SEED-TEXT");
    return TCL_ERROR;
  }
  if( Tcl_GetIntFromObj(objv[0],&i) ) return TCL_ERROR;
  if( Tcl_GetIntFromObj(interp,objv[0],&i) ) return TCL_ERROR;
  sqlite3_test_control(SQLITE_TESTCTRL_PRNG_SEED, (unsigned int)i);
  sqlite3_randomness(0,0);
  return TCL_OK;
}

/*
** tclcmd:  database_may_be_corrupt
Changes to test/dbfuzz2.c.
207
208
209
210
211
212
213




214
215
216
217
218
219
220
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224







+
+
+
+







#endif
  if( bVdbeDebug ){
    sqlite3_exec(db, "PRAGMA vdbe_debug=ON", 0, 0, 0);
  }
  if( mxCb>0 ){
    sqlite3_progress_handler(db, 10, progress_handler, 0);
  }
#ifdef SQLITE_TESTCTRL_PRNG_SEED
  sqlite3_test_control(SQLITE_TESTCTRL_PRNG_SEED, 0);
  sqlite3_randomness(0,0);
#endif
  for(i=0; i<sizeof(azSql)/sizeof(azSql[0]); i++){
    if( eVerbosity>=1 ){
      printf("%s\n", azSql[i]);
      fflush(stdout);
    }
    zErr = 0;
    nCb = 0;
Changes to test/fuzzcheck.c.
1802
1803
1804
1805
1806
1807
1808




1809
1810
1811
1812
1813
1814
1815
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819







+
+
+
+







          setAlarm(iTimeout);
#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
          if( sqlFuzz || vdbeLimitFlag ){
            sqlite3_progress_handler(db, 100000, progressHandler,
                                     &vdbeLimitFlag);
          }
#endif
#ifdef SQLITE_TESTCTRL_PRNG_SEED
          sqlite3_test_control(SQLITE_TESTCTRL_PRNG_SEED, 0);
          sqlite3_randomness(0,0);
#endif
          do{
            runSql(db, (char*)pSql->a, runFlags);
          }while( timeoutTest );
          setAlarm(0);
          sqlite3_exec(db, "PRAGMA temp_store_directory=''", 0, 0, 0);
          sqlite3_close(db);
        }