-C Fix\sbuilt-in\sdocumentation\sfor\sthe\s".mode\sqbox"\scommand\sin\sthe\sCLI.
-D 2022-10-24T11:10:40.311
+C Update\sthe\sfuzzinvariant\slogic\sin\sfuzzcheck\sto\sthe\slatest\scode\sfrom\ndbsqlfuzz.
+D 2022-10-24T12:38:32.096
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F test/fuzzer1.test 3d4c4b7e547aba5e5511a2991e3e3d07166cfbb8
F test/fuzzer2.test a85ef814ce071293bce1ad8dffa217cbbaad4c14
F test/fuzzerfault.test f64c4aef4c9e9edf1d6dc0d3f1e65dcc81e67c996403c88d14f09b74807a42bc
-F test/fuzzinvariants.c a91f439e512c72045bddaf0f0ee3b876b2fe645e076aefb085658f1337066f7e
+F test/fuzzinvariants.c 760a1004ae4c4cef398310631ea6d441c5e8297af0f688a2dc7a467afd22df33
F test/gcfault.test dd28c228a38976d6336a3fc42d7e5f1ad060cb8c
F test/gencol1.test cc0dbb0ee116e5602e18ea7d47f2a0f76b26e09a823b7c36ef254370c2b0f3c1
F test/genesis.tcl 1e2e2e8e5cc4058549a154ff1892fe5c9de19f98
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P d96f6cc8475ae5509b8bff2db75e3c6f69a214d58d8979fbc0162ae488a040dc
-R d80b6eff956f308472eb5e33e1c2da52
+P 3d7ea33be1076fd21681bdcff0c489646c017594b42b4a21a74e9e2d3947890b
+R 8f78a5fa1e8c20b5a3592cf3de894b6c
U drh
-Z f106cab0f2ec627c6908493949c58d50
+Z c3f47754444910e4af4759510c20d50b
# Remove this line to create a well-formed Fossil manifest.
/* Forward references */
static char *fuzz_invariant_sql(sqlite3_stmt*, int);
-static int sameValue(sqlite3_stmt*,int,sqlite3_stmt*,int);
+static int sameValue(sqlite3_stmt*,int,sqlite3_stmt*,int,sqlite3_stmt*);
static void reportInvariantFailed(sqlite3_stmt*,sqlite3_stmt*,int);
/*
}
while( (rc = sqlite3_step(pTestStmt))==SQLITE_ROW ){
for(i=0; i<nCol; i++){
- if( !sameValue(pStmt, i, pTestStmt, i) ) break;
+ if( !sameValue(pStmt, i, pTestStmt, i, 0) ) break;
}
if( i>=nCol ) break;
}
if( rc==SQLITE_DONE ){
/* No matching output row found */
sqlite3_stmt *pCk = 0;
+
+ /* This is not a fault if the database file is corrupt, because anything
+ ** can happen with a corrupt database file */
rc = sqlite3_prepare_v2(db, "PRAGMA integrity_check", -1, &pCk, 0);
if( rc ){
sqlite3_finalize(pCk);
return SQLITE_CORRUPT;
}
sqlite3_finalize(pCk);
+
if( sqlite3_strlike("%group%by%order%by%desc%",sqlite3_sql(pStmt),0)==0 ){
/* dbsqlfuzz crash-647c162051c9b23ce091b7bbbe5125ce5f00e922
** Original statement is:
*/
goto not_a_fault;
}
+
if( sqlite3_strlike("%limit%)%order%by%", sqlite3_sql(pTestStmt),0)==0 ){
/* crash-89bd6a6f8c6166e9a4c5f47b3e70b225f69b76c6
** Original statement is:
*/
goto not_a_fault;
}
+
+ /* The original sameValue() comparison assumed a collating sequence
+ ** of "binary". It can sometimes get an incorrect result for different
+ ** collating sequences. So rerun the test with no assumptions about
+ ** collations.
+ */
+ rc = sqlite3_prepare_v2(db,
+ "SELECT ?1=?2 OR ?1=?2 COLLATE nocase OR ?1=?2 COLLATE rtrim",
+ -1, &pCk, 0);
+ if( rc==SQLITE_OK ){
+ sqlite3_reset(pTestStmt);
+ while( (rc = sqlite3_step(pTestStmt))==SQLITE_ROW ){
+ for(i=0; i<nCol; i++){
+ if( !sameValue(pStmt, i, pTestStmt, i, pCk) ) break;
+ }
+ if( i>=nCol ){
+ sqlite3_finalize(pCk);
+ goto not_a_fault;
+ }
+ }
+ }
+ sqlite3_finalize(pCk);
+
+ /* Invariants do not necessarily work if there are virtual tables
+ ** involved in the query */
rc = sqlite3_prepare_v2(db,
"SELECT 1 FROM bytecode(?1) WHERE opcode='VOpen'", -1, &pCk, 0);
if( rc==SQLITE_OK ){
/*
** Return true if and only if v1 and is the same as v2.
*/
-static int sameValue(sqlite3_stmt *pS1, int i1, sqlite3_stmt *pS2, int i2){
+static int sameValue(
+ sqlite3_stmt *pS1, int i1, /* Value to text on the left */
+ sqlite3_stmt *pS2, int i2, /* Value to test on the right */
+ sqlite3_stmt *pTestCompare /* COLLATE comparison statement or NULL */
+){
int x = 1;
int t1 = sqlite3_column_type(pS1,i1);
int t2 = sqlite3_column_type(pS2,i2);
const char *z2 = (const char*)sqlite3_column_text(pS2,i2);
x = ((z1==0 && z2==0) || (z1!=0 && z2!=0 && strcmp(z1,z1)==0));
printf("Encodings differ. %d on left and %d on right\n", e1, e2);
+ abort();
+ }
+ if( pTestCompare ){
+ sqlite3_bind_value(pTestCompare, 1, sqlite3_column_value(pS1,i1));
+ sqlite3_bind_value(pTestCompare, 2, sqlite3_column_value(pS2,i2));
+ x = sqlite3_step(pTestCompare)==SQLITE_ROW
+ && sqlite3_column_int(pTestCompare,0)!=0;
+ sqlite3_reset(pTestCompare);
break;
}
if( e1!=SQLITE_UTF8 ){