]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Modifications to test files to omit any tests that intentionally access out-of-bounds...
authordan <dan@noemail.net>
Thu, 23 Jan 2014 14:44:08 +0000 (14:44 +0000)
committerdan <dan@noemail.net>
Thu, 23 Jan 2014 14:44:08 +0000 (14:44 +0000)
FossilOrigin-Name: f4a701d55f5c4e1e62ed64b779ad4fff89dd31b7

manifest
manifest.uuid
src/test1.c
test/capi3.test
test/capi3c.test
test/e_fkey.test
test/misc7.test
test/misuse.test
test/select7.test

index 0452c399e9c054f8d4b67bbed9278021701b1c1c..eff8df84716a24cee6e6cc1784cd0066e4fccd5e 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Avoid\san\sextra\sseek\swhen\sinserting\srecords\sinto\sthe\sepheremal\sindex\sused\sto\sensure\sthat\srows\sreturned\sby\sUNION\srecursive\squeries\sare\sunique.
-D 2014-01-22T19:23:30.685
+C Modifications\sto\stest\sfiles\sto\somit\sany\stests\sthat\sintentionally\saccess\sout-of-bounds\slocations\sin\sclang\s-fsanitize=address\sbuilds.
+D 2014-01-23T14:44:08.207
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -229,7 +229,7 @@ F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
 F src/status.c 7ac05a5c7017d0b9f0b4bcd701228b784f987158
 F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
 F src/tclsqlite.c 46073db71011b6542fde1f234c56a076d5ff23f9
-F src/test1.c db16ba651453b15001c7f2838c446284dde4ecaf
+F src/test1.c 2401eee14a4309a7cfe2aeb2f30ad517a1d9c299
 F src/test2.c 7355101c085304b90024f2261e056cdff13c6c35
 F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c
 F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df
@@ -364,9 +364,9 @@ F test/btreefault.test c2bcb542685eea44621275cfedbd8a13f65201e3
 F test/busy.test 76b4887f8b9160ba903c1ac22e8ff406ad6ae2f0
 F test/cache.test 13bc046b26210471ca6f2889aceb1ea52dc717de
 F test/capi2.test 011c16da245fdc0106a2785035de6b242c05e738
-F test/capi3.test 56ab450125ead38846cbae7e5b6a216686c3cffa
+F test/capi3.test 6cdd49656bd62a296924f4d2fcfd05cd2a298369
 F test/capi3b.test efb2b9cfd127efa84433cd7a2d72ce0454ae0dc4
-F test/capi3c.test 93d24621c9ff84da9da060f30431e0453db1cdb0
+F test/capi3c.test a21869e4d50d5dbb7e566e328fc0bc7c2efa6a32
 F test/capi3d.test 6d0fc0a86d73f42dd19a7d8b7761ab9bc02277d0
 F test/capi3e.test ad90088b18b0367125ff2d4b5400153fd2f99aab
 F test/cast.test 4c275cbdc8202d6f9c54a3596701719868ac7dc3
@@ -439,7 +439,7 @@ F test/e_delete.test d5186e2f5478b659f16a2c8b66c09892823e542a
 F test/e_droptrigger.test 3cd080807622c13e5bbb61fc9a57bd7754da2412
 F test/e_dropview.test 0c9f7f60989164a70a67a9d9c26d1083bc808306
 F test/e_expr.test 5c71d183fbf519a4769fd2e2124afdc70b5b1f42
-F test/e_fkey.test d83a04478bb9c02d2c513518548a69f818869f41
+F test/e_fkey.test 630597377549af579d34faaf64c6959a5a68ef76
 F test/e_fts3.test 5c02288842e4f941896fd44afdef564dd5fc1459
 F test/e_insert.test 1e44f84d2abe44d66e4fbf198be4b20e3cc724a0
 F test/e_reindex.test 396b7b4f0a66863b4e95116a67d93b227193e589
@@ -700,8 +700,8 @@ F test/misc3.test cf3dda47d5dda3e53fc5804a100d3c82be736c9d
 F test/misc4.test 9c078510fbfff05a9869a0b6d8b86a623ad2c4f6
 F test/misc5.test 528468b26d03303b1f047146e5eefc941b9069f5
 F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91
-F test/misc7.test 1265eb98c2e22a446a13fdef754118b272716684
-F test/misuse.test ba4fb5d1a6101d1c171ea38b3c613d0661c83054
+F test/misc7.test edd0b63e2ee29a256900b0514f6fff27e19e9bb2
+F test/misuse.test 3c34719944ba045cc6c188a4852ba04680728912
 F test/mmap1.test 93d167b328255cbe6679fe1e1a23be1b1197d07b
 F test/mmap2.test 9d6dd9ddb4ad2379f29cc78f38ce1e63ed418022
 F test/mmap3.test c92273e16eb8d23c1d55c9815b446bb72ef0512e
@@ -783,7 +783,7 @@ F test/select3.test 2ce595f8fb8e2ac10071d3b4e424cadd4634a054
 F test/select4.test 00179be44e531fe04c1c3f15df216439dff2519d
 F test/select5.test e758b8ef94f69b111df4cb819008856655dcd535
 F test/select6.test e76bd10a56988f15726c097a5d5a7966fe82d3b2
-F test/select7.test dad6f00f0d49728a879d6eb6451d4752db0b0abe
+F test/select7.test 7fd2ef598cfabb6b9ff6ac13973b91d0527df49d
 F test/select8.test 391de11bdd52339c30580dabbbbe97e3e9a3c79d
 F test/select9.test aebc2bb0c3bc44606125033cbcaac2c8d1f33a95
 F test/selectA.test 99cf21df033b93033ea4f34aba14a500f48f04fe
@@ -1152,7 +1152,7 @@ F tool/vdbe-compress.tcl 0cf56e9263a152b84da86e75a5c0cdcdb7a47891
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
-P dea2ca6a159d5dcfd8deceedf1c2a73fb4ac1cfc
-R 94fca679783d65c2e2622ed1059ebe94
+P 72c4b3f07a3faacb5b62d5bc374b4e125a0bd8b3
+R 1a965aa9944d1df45f2b3d9d29de01da
 U dan
-Z f354f4f3e5d1356fcb7db559f2782a7e
+Z 5e3d3ac89b5b8048d3858093fe9eb7e9
index 93493f97ebd08be6321447773a558ac6aeb9f341..d96db9705f0ffdc4f27a5bfb5596c2973432f820 100644 (file)
@@ -1 +1 @@
-72c4b3f07a3faacb5b62d5bc374b4e125a0bd8b3
\ No newline at end of file
+f4a701d55f5c4e1e62ed64b779ad4fff89dd31b7
\ No newline at end of file
index 109f90143f743ef8eace353ffad83478134e8dc4..3000288c7df7f378ee783a7334cd25b8daa0f10a 100644 (file)
@@ -242,7 +242,28 @@ static int test_io_trace(
   return TCL_OK;
 }
 
-
+/*
+** Usage:  clang_sanitize_address 
+**
+** Returns true if the program was compiled using clang with the 
+** -fsanitize=address switch on the command line. False otherwise.
+*/
+static int clang_sanitize_address(
+  void *NotUsed,
+  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
+  int argc,              /* Number of arguments */
+  char **argv            /* Text of each argument */
+){
+  int res = 0;
+#if defined(__has_feature)
+# if __has_feature(address_sanitizer)
+  res = 1;
+# endif
+#endif
+  Tcl_SetObjResult(interp, Tcl_NewIntObj(res));
+  return TCL_OK;
+}
+  
 /*
 ** Usage:  sqlite3_exec_printf  DB  FORMAT  STRING
 **
@@ -6323,6 +6344,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
      { "sqlite3_busy_timeout",          (Tcl_CmdProc*)test_busy_timeout     },
      { "printf",                        (Tcl_CmdProc*)test_printf           },
      { "sqlite3IoTrace",              (Tcl_CmdProc*)test_io_trace         },
+     { "clang_sanitize_address",        (Tcl_CmdProc*)clang_sanitize_address },
   };
   static struct {
      char *zName;
index 9d7434d25d2247f8ebf6af66c4dcd4c3d0ef6363..f0234e889742c2dd1948dab800cb0da1f0253e2d 100644 (file)
@@ -179,16 +179,18 @@ do_test capi3-3.4 {
 do_test capi3-3.5 {
   sqlite3_close $db2
 } {SQLITE_OK}
-do_test capi3-3.6.1-misuse {
-  sqlite3_close $db2
-} {SQLITE_MISUSE}
-do_test capi3-3.6.2-misuse {
-  sqlite3_errmsg $db2
-} {library routine called out of sequence}
-ifcapable {utf16} {
-  do_test capi3-3.6.3-misuse {
-    utf8 [sqlite3_errmsg16 $db2]
+if {[clang_sanitize_address]==0} {
+  do_test capi3-3.6.1-misuse {
+    sqlite3_close $db2
+  } {SQLITE_MISUSE}
+  do_test capi3-3.6.2-misuse {
+    sqlite3_errmsg $db2
   } {library routine called out of sequence}
+  ifcapable {utf16} {
+    do_test capi3-3.6.3-misuse {
+      utf8 [sqlite3_errmsg16 $db2]
+    } {library routine called out of sequence}
+  }
 }
 
 do_test capi3-3.7 {
@@ -661,10 +663,12 @@ do_test capi3-6.3 {
   sqlite3_finalize $STMT
 } {SQLITE_OK}
 
-do_test capi3-6.4-misuse {
-  db cache flush
-  sqlite3_close $DB
-} {SQLITE_OK}
+if {[clang_sanitize_address]==0} {
+  do_test capi3-6.4-misuse {
+    db cache flush
+    sqlite3_close $DB
+  } {SQLITE_OK}
+}
 db close
 
 # This procedure sets the value of the file-format in file 'test.db'
@@ -1060,11 +1064,13 @@ if {[llength [info commands sqlite3_sleep]]>0} {
 }
 
 # Ticket #1219:  Make sure binding APIs can handle a NULL pointer.
-#
-do_test capi3-14.1-misuse {
-  set rc [catch {sqlite3_bind_text 0 1 hello 5} msg]
-  lappend rc $msg
-} {1 SQLITE_MISUSE}
+# 
+if {[clang_sanitize_address]==0} {
+  do_test capi3-14.1-misuse {
+    set rc [catch {sqlite3_bind_text 0 1 hello 5} msg]
+      lappend rc $msg
+  } {1 SQLITE_MISUSE}
+}
 
 # Ticket #1650:  Honor the nBytes parameter to sqlite3_prepare.
 #
index 14545c0a68ddb42bc83286ccd1967072dc1965a3..6388717e00dbb1b7f696b9854a14cfe9af6cc486 100644 (file)
@@ -169,16 +169,18 @@ do_test capi3c-3.4 {
 do_test capi3c-3.5 {
   sqlite3_close $db2
 } {SQLITE_OK}
-do_test capi3c-3.6.1-misuse {
-  sqlite3_close $db2
-} {SQLITE_MISUSE}
-do_test capi3c-3.6.2-misuse {
-  sqlite3_errmsg $db2
-} {library routine called out of sequence}
-ifcapable {utf16} {
-  do_test capi3c-3.6.3-misuse {
-    utf8 [sqlite3_errmsg16 $db2]
+if {[clang_sanitize_address]==0} {
+  do_test capi3c-3.6.1-misuse {
+    sqlite3_close $db2
+  } {SQLITE_MISUSE}
+  do_test capi3c-3.6.2-misuse {
+    sqlite3_errmsg $db2
   } {library routine called out of sequence}
+  ifcapable {utf16} {
+    do_test capi3c-3.6.3-misuse {
+      utf8 [sqlite3_errmsg16 $db2]
+    } {library routine called out of sequence}
+  }
 }
 
 # rename sqlite3_open ""
@@ -627,13 +629,17 @@ check_data $STMT capi3c-6.3 {INTEGER} {1} {1.0} {1}
 do_test capi3c-6.3 {
   sqlite3_finalize $STMT
 } {SQLITE_OK}
-do_test capi3c-6.4 {
-  db cache flush
-  sqlite3_close $DB
-} {SQLITE_OK}
-do_test capi3c-6.99-misuse {
+if {[clang_sanitize_address]==0} {
+  do_test capi3c-6.4 {
+    db cache flush
+      sqlite3_close $DB
+  } {SQLITE_OK}
+  do_test capi3c-6.99-misuse {
+    db close
+  } {}
+} else {
   db close
-} {}
+}
 
 # This procedure sets the value of the file-format in file 'test.db'
 # to $newval. Also, the schema cookie is incremented.
index 022611695da2281047d2dda6962c4676de90139d..921e9671763b2dc6e7d51cccbb025d20681d4330 100644 (file)
@@ -2946,38 +2946,45 @@ proc test_on_update_recursion {limit} {
   "
 }
 
-do_test e_fkey-63.1.1 {
-  test_on_delete_recursion $SQLITE_MAX_TRIGGER_DEPTH
-} {0 0}
-do_test e_fkey-63.1.2 {
-  test_on_delete_recursion [expr $SQLITE_MAX_TRIGGER_DEPTH+1]
-} {1 {too many levels of trigger recursion}}
-do_test e_fkey-63.1.3 {
-  sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 5
-  test_on_delete_recursion 5
-} {0 0}
-do_test e_fkey-63.1.4 {
-  test_on_delete_recursion 6
-} {1 {too many levels of trigger recursion}}
-do_test e_fkey-63.1.5 {
-  sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 1000000
-} {5}
-do_test e_fkey-63.2.1 {
-  test_on_update_recursion $SQLITE_MAX_TRIGGER_DEPTH
-} {0 0}
-do_test e_fkey-63.2.2 {
-  test_on_update_recursion [expr $SQLITE_MAX_TRIGGER_DEPTH+1]
-} {1 {too many levels of trigger recursion}}
-do_test e_fkey-63.2.3 {
-  sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 5
-  test_on_update_recursion 5
-} {0 0}
-do_test e_fkey-63.2.4 {
-  test_on_update_recursion 6
-} {1 {too many levels of trigger recursion}}
-do_test e_fkey-63.2.5 {
-  sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 1000000
-} {5}
+# If the current build was created using clang with the -fsanitize=address
+# switch, then the library uses considerably more stack space than usual.
+# So much more, that some of the following tests cause stack overflows
+# if they are run under this configuration.
+#
+if {[clang_sanitize_address]==0} {
+  do_test e_fkey-63.1.1 {
+    test_on_delete_recursion $SQLITE_MAX_TRIGGER_DEPTH
+  } {0 0}
+  do_test e_fkey-63.1.2 {
+    test_on_delete_recursion [expr $SQLITE_MAX_TRIGGER_DEPTH+1]
+  } {1 {too many levels of trigger recursion}}
+  do_test e_fkey-63.1.3 {
+    sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 5
+      test_on_delete_recursion 5
+  } {0 0}
+  do_test e_fkey-63.1.4 {
+    test_on_delete_recursion 6
+  } {1 {too many levels of trigger recursion}}
+  do_test e_fkey-63.1.5 {
+    sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 1000000
+  } {5}
+  do_test e_fkey-63.2.1 {
+    test_on_update_recursion $SQLITE_MAX_TRIGGER_DEPTH
+  } {0 0}
+  do_test e_fkey-63.2.2 {
+    test_on_update_recursion [expr $SQLITE_MAX_TRIGGER_DEPTH+1]
+  } {1 {too many levels of trigger recursion}}
+  do_test e_fkey-63.2.3 {
+    sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 5
+      test_on_update_recursion 5
+  } {0 0}
+  do_test e_fkey-63.2.4 {
+    test_on_update_recursion 6
+  } {1 {too many levels of trigger recursion}}
+  do_test e_fkey-63.2.5 {
+    sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 1000000
+  } {5}
+}
 
 #-------------------------------------------------------------------------
 # The setting of the recursive_triggers pragma does not affect foreign
index ec042ff0ee318f3c1850fbd31f3b8c11c8809a21..8fd5fe754620713b95634277515f6965d48f17e6 100644 (file)
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
 
-do_test misc7-1-misuse {
-  c_misuse_test
-} {}
+if {[clang_sanitize_address]==0} {
+  do_test misc7-1-misuse {
+    c_misuse_test
+  } {}
+}
 
 do_test misc7-2 {
   c_realloc_test
index 71ee0118c8b6ef9f9fb884798fd756c92d3238e1..d5d836cbfbf13e0dd45b8c2d20956685434bd237 100644 (file)
@@ -171,37 +171,40 @@ do_test misuse-4.3 {
   } msg]
   lappend v $msg $r
 } {0 {} SQLITE_BUSY}
-do_test misuse-4.4 {
+
+if {[clang_sanitize_address]==0} {
+  do_test misuse-4.4 {
   # Flush the TCL statement cache here, otherwise the sqlite3_close() will
   # fail because there are still un-finalized() VDBEs.
-  db cache flush
-  sqlite3_close $::DB
-  catchsql2 {SELECT * FROM t1}
-} {1 {library routine called out of sequence}}
-do_test misuse-4.5 {
-  catchsql {
-    SELECT * FROM t1
-  }
-} {1 {library routine called out of sequence}}
+    db cache flush
+      sqlite3_close $::DB
+      catchsql2 {SELECT * FROM t1}
+  } {1 {library routine called out of sequence}}
+  do_test misuse-4.5 {
+    catchsql {
+      SELECT * FROM t1
+    }
+  } {1 {library routine called out of sequence}}
 
-# Attempt to use a database after it has been closed.
-#
-do_test misuse-5.1 {
-  db close
-  sqlite3 db test2.db; set ::DB [sqlite3_connection_pointer db]
-  execsql {
-    SELECT * FROM t1
-  }
-} {1 2}
-do_test misuse-5.2 {
-  catchsql2 {SELECT * FROM t1}
-} {0 {a b 1 2}}
-do_test misuse-5.3 {
-  db close
-  set r [catch {
-    sqlite3_prepare $::DB {SELECT * FROM t1} -1 TAIL
-  } msg]
-  lappend r $msg
-} {1 {(21) library routine called out of sequence}}
+  # Attempt to use a database after it has been closed.
+  #
+  do_test misuse-5.1 {
+    db close
+      sqlite3 db test2.db; set ::DB [sqlite3_connection_pointer db]
+      execsql {
+        SELECT * FROM t1
+      }
+  } {1 2}
+  do_test misuse-5.2 {
+    catchsql2 {SELECT * FROM t1}
+  } {0 {a b 1 2}}
+  do_test misuse-5.3 {
+    db close
+      set r [catch {
+        sqlite3_prepare $::DB {SELECT * FROM t1} -1 TAIL
+      } msg]
+    lappend r $msg
+  } {1 {(21) library routine called out of sequence}}
+}
 
 finish_test
index e8fc4400064faa52317ac439f0dad2cd7b75df19..6816b9fcb9924842d5d3ce1d57f4f88b91c47a48 100644 (file)
@@ -138,21 +138,23 @@ ifcapable {subquery && compound} {
 # Verify that an error occurs if you have too many terms on a
 # compound select statement.
 #
-ifcapable compound {
-  if {$SQLITE_MAX_COMPOUND_SELECT>0} {
-    set sql {SELECT 0}
-    set result 0
-    for {set i 1} {$i<$SQLITE_MAX_COMPOUND_SELECT} {incr i} {
-      append sql " UNION ALL SELECT $i"
-      lappend result $i
+if {[clang_sanitize_address]==0} {
+  ifcapable compound {
+    if {$SQLITE_MAX_COMPOUND_SELECT>0} {
+      set sql {SELECT 0}
+      set result 0
+        for {set i 1} {$i<$SQLITE_MAX_COMPOUND_SELECT} {incr i} {
+          append sql " UNION ALL SELECT $i"
+            lappend result $i
+        }
+      do_test select7-6.1 {
+        catchsql $sql
+      } [list 0 $result]
+      append sql { UNION ALL SELECT 99999999}
+      do_test select7-6.2 {
+        catchsql $sql
+      } {1 {too many terms in compound SELECT}}
     }
-    do_test select7-6.1 {
-      catchsql $sql
-    } [list 0 $result]
-    append sql { UNION ALL SELECT 99999999}
-    do_test select7-6.2 {
-      catchsql $sql
-    } {1 {too many terms in compound SELECT}}
   }
 }