/ 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 | SQL 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
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
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test1.c.

  6388   6388     Tcl_Obj *CONST objv[]  /* Command arguments */
  6389   6389   ){
  6390   6390     unsigned int i;
  6391   6391     if( objc!=2 ){
  6392   6392       Tcl_WrongNumArgs(interp, 1, objv, "PRNG-SEED-TEXT");
  6393   6393       return TCL_ERROR;
  6394   6394     }
  6395         -  if( Tcl_GetIntFromObj(objv[0],&i) ) return TCL_ERROR;
         6395  +  if( Tcl_GetIntFromObj(interp,objv[0],&i) ) return TCL_ERROR;
  6396   6396     sqlite3_test_control(SQLITE_TESTCTRL_PRNG_SEED, (unsigned int)i);
  6397   6397     sqlite3_randomness(0,0);
  6398   6398     return TCL_OK;
  6399   6399   }
  6400   6400   
  6401   6401   /*
  6402   6402   ** tclcmd:  database_may_be_corrupt

Changes to test/dbfuzz2.c.

   207    207   #endif
   208    208     if( bVdbeDebug ){
   209    209       sqlite3_exec(db, "PRAGMA vdbe_debug=ON", 0, 0, 0);
   210    210     }
   211    211     if( mxCb>0 ){
   212    212       sqlite3_progress_handler(db, 10, progress_handler, 0);
   213    213     }
          214  +#ifdef SQLITE_TESTCTRL_PRNG_SEED
          215  +  sqlite3_test_control(SQLITE_TESTCTRL_PRNG_SEED, 0);
          216  +  sqlite3_randomness(0,0);
          217  +#endif
   214    218     for(i=0; i<sizeof(azSql)/sizeof(azSql[0]); i++){
   215    219       if( eVerbosity>=1 ){
   216    220         printf("%s\n", azSql[i]);
   217    221         fflush(stdout);
   218    222       }
   219    223       zErr = 0;
   220    224       nCb = 0;

Changes to test/fuzzcheck.c.

  1802   1802             setAlarm(iTimeout);
  1803   1803   #ifndef SQLITE_OMIT_PROGRESS_CALLBACK
  1804   1804             if( sqlFuzz || vdbeLimitFlag ){
  1805   1805               sqlite3_progress_handler(db, 100000, progressHandler,
  1806   1806                                        &vdbeLimitFlag);
  1807   1807             }
  1808   1808   #endif
         1809  +#ifdef SQLITE_TESTCTRL_PRNG_SEED
         1810  +          sqlite3_test_control(SQLITE_TESTCTRL_PRNG_SEED, 0);
         1811  +          sqlite3_randomness(0,0);
         1812  +#endif
  1809   1813             do{
  1810   1814               runSql(db, (char*)pSql->a, runFlags);
  1811   1815             }while( timeoutTest );
  1812   1816             setAlarm(0);
  1813   1817             sqlite3_exec(db, "PRAGMA temp_store_directory=''", 0, 0, 0);
  1814   1818             sqlite3_close(db);
  1815   1819           }