/ Check-in [7bd20a20]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Avoid running tests that use sqlite_dbpage with SQLITE_OMIT_VIRTUAL_TABLE builds.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7bd20a20a0f422765a6e469d1a1b67b95c4a441931688e04a2b1b491a5238528
User & Date: dan 2017-10-22 07:57:29
Context
2017-10-22
08:02
Fix test cases in dbpage.test so that they work with SQLITE_DEFAULT_AUTOVACUUM=1 builds. check-in: 0fcf1e61 user: dan tags: trunk
07:58
Avoid running tests that use sqlite_dbpage with SQLITE_OMIT_VIRTUAL_TABLE builds. check-in: 6dde8d61 user: dan tags: branch-3.21
07:57
Avoid running tests that use sqlite_dbpage with SQLITE_OMIT_VIRTUAL_TABLE builds. check-in: 7bd20a20 user: dan tags: trunk
2017-10-21
14:17
Catch and avoid a 16-bit integer overflow on the number of columns in a common table expression. This fixes a problem found by OSS-Fuzz. The test case is in TH3. check-in: 6ee8cb6a user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/corruptK.test.

   105    105   
   106    106   do_catchsql_test 2.3 {
   107    107     INSERT INTO t1 VALUES(randomblob(900));
   108    108   } {1 {database disk image is malformed}}
   109    109   
   110    110   #-------------------------------------------------------------------------
   111    111   
   112         -proc hex2blob {hex} {
   113         -  # Split on newlines:
   114         -  set bytes [list]
   115         -  foreach l [split $hex "\n"] {
   116         -    if {[string is space $l]} continue
   117         -    set L [list]
   118         -    foreach b [split $l] {
   119         -      if {[string is xdigit $b] && [string length $b]==2} { 
   120         -        lappend L [expr "0x$b"]
          112  +ifcapable vtab {
          113  +
          114  +  proc hex2blob {hex} {
          115  +    # Split on newlines:
          116  +    set bytes [list]
          117  +    foreach l [split $hex "\n"] {
          118  +      if {[string is space $l]} continue
          119  +      set L [list]
          120  +      foreach b [split $l] {
          121  +        if {[string is xdigit $b] && [string length $b]==2} { 
          122  +          lappend L [expr "0x$b"]
          123  +        }
          124  +      }
          125  +      if {[llength $L]!=16} {
          126  +        error "Badly formed hex (1)"
   121    127         }
   122         -    }
   123         -    if {[llength $L]!=16} {
   124         -      error "Badly formed hex (1)"
          128  +      set bytes [concat $bytes $L]
   125    129       }
   126         -    set bytes [concat $bytes $L]
          130  +  
          131  +    binary format c* $bytes
          132  +  }
          133  +  
          134  +  reset_db
          135  +  db func hex2blob hex2blob
          136  +  
          137  +  do_execsql_test 3.1 {
          138  +    PRAGMA page_size=1024;
          139  +    CREATE TABLE t1(a, b, c);
          140  +    CREATE TABLE t2(a, b, c);
          141  +    CREATE TABLE t3(a, b, c);
          142  +    CREATE TABLE t4(a, b, c);
          143  +    CREATE TABLE t5(a, b, c);
          144  +  }
          145  +  
          146  +  do_execsql_test 3.2 {
          147  +    UPDATE sqlite_dbpage SET data = hex2blob('
          148  +   000: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3.
          149  +   010: 04 00 01 01 20 40 20 20 00 00 3e d9 00 00 00 06 .... @  ..>.....
          150  +   020: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 04 ................
          151  +   030: 0f 00 00 00 00 00 00 00 00 00 00 01 00 00 83 00 ................
          152  +   040: 00 00 00 00 00 00 00 00 00 00 00 00 00 38 00 00 .............8..
          153  +   050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3e d9 ..............>.
          154  +   060: 00 2d e6 07 0d 00 00 00 01 03 a0 00 03 e0 00 00 .-..............
          155  +   070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          156  +   080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          157  +   090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          158  +   0a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          159  +   0b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          160  +   0c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          161  +   0d0: 00 00 00 00 00 c1 00 00 00 00 00 00 00 00 00 00 ................
          162  +   0e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          163  +   0f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          164  +   100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          165  +   110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          166  +   120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          167  +   130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          168  +   140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          169  +   150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          170  +   160: 00 83 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          171  +   170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          172  +   180: 00 00 00 00 00 00 00 00 00 00 07 00 30 00 00 00 ............0...
          173  +   190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          174  +   1a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          175  +   1b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          176  +   1c0: 02 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 ................
          177  +   1d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          178  +   1e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          179  +   1f0: 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          180  +   200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          181  +   210: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          182  +   220: 00 00 0e 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          183  +   230: 0c 00 00 00 00 00 00 60 00 00 00 06 00 00 c3 00 .......`........
          184  +   240: 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          185  +   250: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          186  +   260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          187  +   270: 00 00 00 18 00 00 00 00 00 00 00 00 00 00 00 00 ................
          188  +   280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          189  +   290: 04 00 0e 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          190  +   2a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          191  +   2b0: 00 00 00 00 83 00 8c 00 00 00 00 00 00 00 00 00 ................
          192  +   2c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          193  +   2d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          194  +   2e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          195  +   2f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          196  +   300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          197  +   310: 00 78 00 00 00 00 00 00 00 00 00 00 00 00 70 00 .x............p.
          198  +   320: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          199  +   330: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          200  +   340: 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 ................
          201  +   350: 00 00 00 00 00 68 00 00 00 00 00 00 00 00 00 00 .....h..........
          202  +   360: 00 00 00 00 00 03 00 00 00 00 00 00 00 00 00 00 ................
          203  +   370: 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 ................
          204  +   380: 00 00 00 00 70 00 00 00 00 00 00 00 00 00 00 00 ....p...........
          205  +   390: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
          206  +   3a0: 5e 01 07 17 1b 1b 01 81 13 74 61 62 6c 65 73 65 ^........tablese
          207  +   3b0: 6e 73 6f 32 73 73 65 6e 73 6f 72 73 02 43 52 45 nso2ssensors.CRE
          208  +   3c0: 41 54 45 20 54 41 42 4c 45 20 73 65 6e 73 6f 72 ATE TABLE sensor
          209  +   3d0: 73 20 0a 20 20 24 20 20 20 20 20 20 20 20 20 20 s .  $          
          210  +   3e0: b8 6e 61 6d 65 21 74 65 78 74 2c 20 79 61 6c 20 .name!text, yal 
          211  +   3f0: 72 65 61 6c 2c 20 74 69 6d 65 20 74 65 78 74 29 real, time text)
          212  +    ') WHERE pgno=1
   127    213     }
   128         -
   129         -  binary format c* $bytes
   130         -}
   131         -
   132         -reset_db
   133         -db func hex2blob hex2blob
   134         -
   135         -do_execsql_test 3.1 {
   136         -  PRAGMA page_size=1024;
   137         -  CREATE TABLE t1(a, b, c);
   138         -  CREATE TABLE t2(a, b, c);
   139         -  CREATE TABLE t3(a, b, c);
   140         -  CREATE TABLE t4(a, b, c);
   141         -  CREATE TABLE t5(a, b, c);
   142         -}
   143         -
   144         -do_execsql_test 3.2 {
   145         -  UPDATE sqlite_dbpage SET data = hex2blob('
   146         - 000: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3.
   147         - 010: 04 00 01 01 20 40 20 20 00 00 3e d9 00 00 00 06 .... @  ..>.....
   148         - 020: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 04 ................
   149         - 030: 0f 00 00 00 00 00 00 00 00 00 00 01 00 00 83 00 ................
   150         - 040: 00 00 00 00 00 00 00 00 00 00 00 00 00 38 00 00 .............8..
   151         - 050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3e d9 ..............>.
   152         - 060: 00 2d e6 07 0d 00 00 00 01 03 a0 00 03 e0 00 00 .-..............
   153         - 070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   154         - 080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   155         - 090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   156         - 0a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   157         - 0b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   158         - 0c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   159         - 0d0: 00 00 00 00 00 c1 00 00 00 00 00 00 00 00 00 00 ................
   160         - 0e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   161         - 0f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   162         - 100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   163         - 110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   164         - 120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   165         - 130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   166         - 140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   167         - 150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   168         - 160: 00 83 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   169         - 170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   170         - 180: 00 00 00 00 00 00 00 00 00 00 07 00 30 00 00 00 ............0...
   171         - 190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   172         - 1a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   173         - 1b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   174         - 1c0: 02 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 ................
   175         - 1d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   176         - 1e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   177         - 1f0: 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   178         - 200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   179         - 210: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   180         - 220: 00 00 0e 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   181         - 230: 0c 00 00 00 00 00 00 60 00 00 00 06 00 00 c3 00 .......`........
   182         - 240: 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   183         - 250: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   184         - 260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   185         - 270: 00 00 00 18 00 00 00 00 00 00 00 00 00 00 00 00 ................
   186         - 280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   187         - 290: 04 00 0e 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   188         - 2a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   189         - 2b0: 00 00 00 00 83 00 8c 00 00 00 00 00 00 00 00 00 ................
   190         - 2c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   191         - 2d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   192         - 2e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   193         - 2f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   194         - 300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   195         - 310: 00 78 00 00 00 00 00 00 00 00 00 00 00 00 70 00 .x............p.
   196         - 320: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   197         - 330: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   198         - 340: 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 ................
   199         - 350: 00 00 00 00 00 68 00 00 00 00 00 00 00 00 00 00 .....h..........
   200         - 360: 00 00 00 00 00 03 00 00 00 00 00 00 00 00 00 00 ................
   201         - 370: 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 ................
   202         - 380: 00 00 00 00 70 00 00 00 00 00 00 00 00 00 00 00 ....p...........
   203         - 390: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   204         - 3a0: 5e 01 07 17 1b 1b 01 81 13 74 61 62 6c 65 73 65 ^........tablese
   205         - 3b0: 6e 73 6f 32 73 73 65 6e 73 6f 72 73 02 43 52 45 nso2ssensors.CRE
   206         - 3c0: 41 54 45 20 54 41 42 4c 45 20 73 65 6e 73 6f 72 ATE TABLE sensor
   207         - 3d0: 73 20 0a 20 20 24 20 20 20 20 20 20 20 20 20 20 s .  $          
   208         - 3e0: b8 6e 61 6d 65 21 74 65 78 74 2c 20 79 61 6c 20 .name!text, yal 
   209         - 3f0: 72 65 61 6c 2c 20 74 69 6d 65 20 74 65 78 74 29 real, time text)
   210         -  ') WHERE pgno=1
   211         -}
          214  +  
          215  +  db close
          216  +  sqlite3 db test.db
          217  +  
          218  +  do_catchsql_test 3.3 {
          219  +    PRAGMA integrity_check;
          220  +  } {1 {database disk image is malformed}}
   212    221   
   213         -db close
   214         -sqlite3 db test.db
   215         -
   216         -do_catchsql_test 3.3 {
   217         -  PRAGMA integrity_check;
   218         -} {1 {database disk image is malformed}}
          222  +} ;# ifcapable vtab
   219    223   
   220    224   
   221    225   
   222    226   finish_test