From: drh <> Date: Sat, 6 Apr 2024 17:37:30 +0000 (+0000) Subject: Improvements to the accurancy of the fuzzinvariants.c testing module when X-Git-Tag: version-3.46.0~77 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8181cc6c105f3a0253999563d73aa541a6f9916e;p=thirdparty%2Fsqlite.git Improvements to the accurancy of the fuzzinvariants.c testing module when SQLITE_ALLOW_ROWID_IN_VIEW is defined and the test query involves rowids. FossilOrigin-Name: c6e873d4db3ef36a0d561e64ead6feada5d1654c0757b4b6e55f671c9db66469 --- diff --git a/manifest b/manifest index 8b598b2633..3fc2321c7a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Check-in\s[a9657c87c53c1922]\sis\swrong:\sthe\sIndexedExpr.bMaybeNullRow\sflag\sis\nrequired\sfor\svirtual\scolumns\sif\sthey\sare\spart\sof\san\souter\sjoin.\s\sAdd\sa\ntest\scase\s(derived\sfrom\sdbsqlfuzz\sb9e65e2f110df998f1306571fae7af6c01e4d92b)\nto\sprove\sit. -D 2024-04-05T13:56:05.021 +C Improvements\sto\sthe\saccurancy\sof\sthe\sfuzzinvariants.c\stesting\smodule\swhen\nSQLITE_ALLOW_ROWID_IN_VIEW\sis\sdefined\sand\sthe\stest\squery\sinvolves\srowids. +D 2024-04-06T17:37:30.138 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -1258,7 +1258,7 @@ F test/fuzzdata8.db 4a53b6d077c6a5c23b609d8d3ac66996fa55ba3f8d02f9b6efdd0214a767 F test/fuzzer1.test 3d4c4b7e547aba5e5511a2991e3e3d07166cfbb8 F test/fuzzer2.test a85ef814ce071293bce1ad8dffa217cbbaad4c14 F test/fuzzerfault.test f64c4aef4c9e9edf1d6dc0d3f1e65dcc81e67c996403c88d14f09b74807a42bc -F test/fuzzinvariants.c 4355043e98cd8555c62462fcbba91c17c6492b0b017bbbe68656d5f2208f6444 +F test/fuzzinvariants.c 9fc6810dde21e1aee20ed7a6c8ed944ffee127cf082fc48caba398fa31c762ca F test/gcfault.test 4ea410ac161e685f17b19e1f606f58514a2850e806c65b846d05f60d436c5b0d F test/gencol1.test e169bdfa11c7ed5e9f322a98a7db3afe9e66235750b68c923efee8e1876b46ec F test/genesis.tcl 1e2e2e8e5cc4058549a154ff1892fe5c9de19f98 @@ -2184,9 +2184,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c7896e88850669e18e89d44c4169d4f4a5d4b904bea6ccb2ac64f93b6d348a42 -Q -a9657c87c53c19228a42559c82c54b504a5ad729e407e9e2c7dabcc0c949b261 -R 00fdd25fa9a3c1e58bfe6d44fd3eb812 +P 4484ec6d26b31305e31de89bdbae26344d8083a7e7de20861430d31737d9979c +R e668dfe755aeff2fdd8b334389296750 U drh -Z d45c3b35e63ad3a95f4d8ac3c99323f3 +Z 4d6c822e968c71422e1200a444d830a0 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0dad7c2062..57aabf40aa 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4484ec6d26b31305e31de89bdbae26344d8083a7e7de20861430d31737d9979c \ No newline at end of file +c6e873d4db3ef36a0d561e64ead6feada5d1654c0757b4b6e55f671c9db66469 \ No newline at end of file diff --git a/test/fuzzinvariants.c b/test/fuzzinvariants.c index 00b2c11742..25b35d4f6b 100644 --- a/test/fuzzinvariants.c +++ b/test/fuzzinvariants.c @@ -223,6 +223,18 @@ not_a_fault: return SQLITE_OK; } +#ifdef SQLITE_ALLOW_ROWID_IN_VIEW +/* +** Return TRUE if the i-th column of pStmt might be a ROWID value. +*/ +static int column_might_be_rowid(sqlite3_stmt *pStmt, int i){ + const char *zColName = sqlite3_column_name(pStmt, i); + if( sqlite3_strlike("%rowid%",zColName,0)==0 ) return 1; + if( sqlite3_strlike("%oid%",zColName,0)==0 ) return 1; + return 0; +} +#endif /* SQLITE_ALLOW_ROWID_IN_VIEW */ + /* ** Generate SQL used to test a statement invariant. @@ -297,9 +309,7 @@ static char *fuzz_invariant_sql(sqlite3_stmt *pStmt, int iCnt){ continue; } #ifdef SQLITE_ALLOW_ROWID_IN_VIEW - if( sqlite3_strlike("%rowid%",zColName,0)==0 - || sqlite3_strlike("%oid%",zColName,0)==0 - ){ + if( column_might_be_rowid(pBase,i) ){ /* ROWID values are unreliable if SQLITE_ALLOW_ROWID_IN_VIEW is used */ continue; } @@ -332,6 +342,11 @@ static char *fuzz_invariant_sql(sqlite3_stmt *pStmt, int iCnt){ /* ** Return true if and only if v1 and is the same as v2. +** +** When compiled with SQLITE_ALLOW_ROWID_IN_VIEW, and if either +** v1 or v2 has a column name that indicates that it is a rowid +** then a NULL value in the rowid column will compare equal to +** an integer value in the other. */ static int sameValue( sqlite3_stmt *pS1, int i1, /* Value to text on the left */ @@ -346,6 +361,20 @@ static int sameValue( || (t1==SQLITE_FLOAT && t2==SQLITE_INTEGER) ){ /* Comparison of numerics is ok */ +#ifdef SQLITE_ALLOW_ROWID_IN_VIEW + }else + if( t1==SQLITE_INTEGER + && t2==SQLITE_NULL + && column_might_be_rowid(pS2,i2) + ){ + return 1; + }else + if( t2==SQLITE_INTEGER + && t1==SQLITE_NULL + && column_might_be_rowid(pS1,i1) + ){ + return 1; +#endif /* SQLITE_ALLOW_ROWID_IN_VIEW */ }else{ return 0; }