Fix the virtual table detection mechanism to avoid false-positives that were

blocking all failures.  Then fix a few of the additional problems that are
revealed by that fix.  More fixes are needed.

FossilOrigin-Name: 42b2e6676fed1508ea0ba17c292e83134825469735700da97817c45d45c54e66
This commit is contained in:
drh 2022-06-17 15:11:31 +00:00
parent 6efabd6cd3
commit 36f904f065
4 changed files with 33 additions and 14 deletions

View File

@ -1,5 +1,5 @@
C Fix\sthe\snew\s--query-invariants\soption\son\sfuzzcheck\sso\sthat\sit\sdoes\snot\nuse\san\sunprotected\ssqlite3_value\sobject\sas\san\sargument\sto\ssqlite3_value_int64().
D 2022-06-17T12:25:33.660
C Fix\sthe\svirtual\stable\sdetection\smechanism\sto\savoid\sfalse-positives\sthat\swere\nblocking\sall\sfailures.\s\sThen\sfix\sa\sfew\sof\sthe\sadditional\sproblems\sthat\sare\nrevealed\sby\sthat\sfix.\s\sMore\sfixes\sare\sneeded.
D 2022-06-17T15:11:31.795
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -1085,7 +1085,7 @@ F test/fuzz3.test 9c813e6613b837cb7a277b0383cd66bfa07042b4cf0317157c35852f30043c
F test/fuzz4.test c229bcdb45518a89e1d208a21343e061503460ac69fae1539320a89f572eb634
F test/fuzz_common.tcl b7197de6ed1ee8250a4f82d67876f4561b42ee8cbbfc6160dcb66331bad3f830
F test/fuzz_malloc.test f348276e732e814802e39f042b1f6da6362a610af73a528d8f76898fde6b22f2
F test/fuzzcheck.c 609152902fb51e718554719f44d13677f68c53d98d15fb359fbefdd134be153b
F test/fuzzcheck.c b18b6ae117937deac68793385d41ff6d73abcd1bf66f66b5b0cb4151d170c8db
F test/fuzzdata1.db 3e86d9cf5aea68ddb8e27c02d7dfdaa226347426c7eb814918e4d95475bf8517
F test/fuzzdata2.db 128b3feeb78918d075c9b14b48610145a0dd4c8d6f1ca7c2870c7e425f5bf31f
F test/fuzzdata3.db c6586d3e3cef0fbc18108f9bb649aa77bfc38aba
@ -1097,7 +1097,7 @@ F test/fuzzdata8.db ca9a97f401b06b0d5376139ec7e1f9e773e13345a9a2d9ccc0032cdbfede
F test/fuzzer1.test 3d4c4b7e547aba5e5511a2991e3e3d07166cfbb8
F test/fuzzer2.test a85ef814ce071293bce1ad8dffa217cbbaad4c14
F test/fuzzerfault.test f64c4aef4c9e9edf1d6dc0d3f1e65dcc81e67c996403c88d14f09b74807a42bc
F test/fuzzinvariants.c e7b413a2526d9f702a2bfea5cbe5bdb7cb88c89b433e3e8ad931888bb5597bd0
F test/fuzzinvariants.c 227ab751f1417bbc135389f2e394ab3f97b4940343aea006283b8888e8166d58
F test/gcfault.test dd28c228a38976d6336a3fc42d7e5f1ad060cb8c
F test/gencol1.test cc0dbb0ee116e5602e18ea7d47f2a0f76b26e09a823b7c36ef254370c2b0f3c1
F test/genesis.tcl 1e2e2e8e5cc4058549a154ff1892fe5c9de19f98
@ -1978,8 +1978,11 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P f23a429d4153518d37387e121f22a30b22e2b31e126ad168e72049a96be86269
R 10f66102aac19f279bc67099d1ccf16a
P d9f820151d74a690b5fa560597a5b3ace20165a112e1b58cb4a7c47b42745643
R 3bffc86c82ff136a0c0c4c0a76be66e5
T *branch * query-invariants
T *sym-query-invariants *
T -sym-trunk *
U drh
Z 8cec7a3e8591667bdea33d0479acc5f3
Z 8dc954db016e69d2c5b338fff670ae32
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
d9f820151d74a690b5fa560597a5b3ace20165a112e1b58cb4a7c47b42745643
42b2e6676fed1508ea0ba17c292e83134825469735700da97817c45d45c54e66

View File

@ -896,9 +896,17 @@ static int block_troublesome_sql(
}
case SQLITE_FUNCTION: {
static const char *azBadFuncs[] = {
"current_date",
"current_time",
"current_timestamp",
"date",
"datetime",
"julianday",
"random",
"randomblob",
"rtreedepth",
"strftime",
"time",
"unixepoch",
};
int i;
for(i=0; i<sizeof(azBadFuncs)/sizeof(azBadFuncs[0]); i++){

View File

@ -71,8 +71,11 @@ int fuzz_invariant(
int rc;
int i;
int nCol;
int nParam;
if( *pbCorrupt ) return SQLITE_DONE;
nParam = sqlite3_bind_parameter_count(pStmt);
if( nParam>100 ) return SQLITE_DONE;
zTest = fuzz_invariant_sql(pStmt, iCnt);
if( zTest==0 ) return SQLITE_DONE;
rc = sqlite3_prepare_v2(db, zTest, -1, &pTestStmt, 0);
@ -88,7 +91,7 @@ int fuzz_invariant(
sqlite3_free(zTest);
nCol = sqlite3_column_count(pStmt);
for(i=0; i<nCol; i++){
sqlite3_bind_value(pTestStmt, i+1, sqlite3_column_value(pStmt,i));
sqlite3_bind_value(pTestStmt, i+1+nParam, sqlite3_column_value(pStmt,i));
}
if( eVerbosity>=2 ){
char *zSql = sqlite3_expanded_sql(pTestStmt);
@ -101,7 +104,7 @@ int fuzz_invariant(
}
if( i>=nCol ) break;
}
if( rc!=SQLITE_ROW ){
if( rc!=SQLITE_ROW && rc!=SQLITE_NOMEM ){
/* No matching output row found */
sqlite3_stmt *pCk = 0;
rc = sqlite3_prepare_v2(db, "PRAGMA integrity_check", -1, &pCk, 0);
@ -123,7 +126,10 @@ int fuzz_invariant(
sqlite3_finalize(pCk);
rc = sqlite3_prepare_v2(db,
"SELECT 1 FROM bytecode(?1) WHERE opcode='VOpen'", -1, &pCk, 0);
if( rc==SQLITE_OK ) rc = sqlite3_step(pCk);
if( rc==SQLITE_OK ){
sqlite3_bind_pointer(pCk, 1, pStmt, "stmt-pointer", 0);
rc = sqlite3_step(pCk);
}
sqlite3_finalize(pCk);
if( rc==SQLITE_DONE ){
reportInvariantFailed(pStmt, pTestStmt, iRow);
@ -155,6 +161,7 @@ static char *fuzz_invariant_sql(sqlite3_stmt *pStmt, int iCnt){
int mxCnt;
int bDistinct = 0;
int bOrderBy = 0;
int nParam = sqlite3_bind_parameter_count(pStmt);
switch( iCnt % 4 ){
case 1: bDistinct = 1; break;
@ -196,7 +203,8 @@ static char *fuzz_invariant_sql(sqlite3_stmt *pStmt, int iCnt){
if( sqlite3_column_type(pStmt, i)==SQLITE_NULL ){
sqlite3_str_appendf(pTest, " %s \"%w\" ISNULL", zAnd, zColName);
}else{
sqlite3_str_appendf(pTest, " %s \"%w\"=?%d", zAnd, zColName, i+1);
sqlite3_str_appendf(pTest, " %s \"%w\"=?%d", zAnd, zColName,
i+1+nParam);
}
zAnd = "AND";
}
@ -253,7 +261,7 @@ static void printRow(sqlite3_stmt *pStmt, int iRow){
int i, nCol;
nCol = sqlite3_column_count(pStmt);
for(i=0; i<nCol; i++){
printf("row%d.col%d] = ", iRow, i);
printf("row%d.col%d = ", iRow, i);
switch( sqlite3_column_type(pStmt, i) ){
case SQLITE_NULL: {
printf("NULL\n");