Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Ensure that it is not possible to open either virtual table or view columns using the blob API. Ticket #3078. (CVS 5041) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
6039328fe05aaf9380d545e84dfabccb |
User & Date: | danielk1977 2008-04-24 09:49:55.000 |
Context
2008-04-24
| ||
12:36 | Fix a crash that can follow a malloc() failure in malloc7.test. (CVS 5042) (check-in: 85eedad186 user: danielk1977 tags: trunk) | |
09:49 | Ensure that it is not possible to open either virtual table or view columns using the blob API. Ticket #3078. (CVS 5041) (check-in: 6039328fe0 user: danielk1977 tags: trunk) | |
08:56 | Minor change to comment on sqlite3_blob_read(). No code changes. Ticket #3072. (CVS 5040) (check-in: adb4bc5a7d user: danielk1977 tags: trunk) | |
Changes
Changes to src/vdbeblob.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file contains code used to implement incremental BLOB I/O. ** | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file contains code used to implement incremental BLOB I/O. ** ** $Id: vdbeblob.c,v 1.22 2008/04/24 09:49:55 danielk1977 Exp $ */ #include "sqliteInt.h" #include "vdbeInt.h" #ifndef SQLITE_OMIT_INCRBLOB |
︙ | ︙ | |||
100 101 102 103 104 105 106 107 108 109 110 111 112 113 | if( rc!=SQLITE_OK ){ sqlite3_mutex_leave(db->mutex); return rc; } sqlite3BtreeEnterAll(db); pTab = sqlite3LocateTable(&sParse, 0, zTable, zDb); if( !pTab ){ if( sParse.zErrMsg ){ sqlite3_snprintf(sizeof(zErr), zErr, "%s", sParse.zErrMsg); } sqlite3_free(sParse.zErrMsg); rc = SQLITE_ERROR; (void)sqlite3SafetyOff(db); | > > > > > > > > > > | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | if( rc!=SQLITE_OK ){ sqlite3_mutex_leave(db->mutex); return rc; } sqlite3BtreeEnterAll(db); pTab = sqlite3LocateTable(&sParse, 0, zTable, zDb); if( pTab && IsVirtual(pTab) ){ pTab = 0; sqlite3ErrorMsg(&sParse, "cannot open virtual table: %s", zTable); } #ifndef SQLITE_OMIT_VIEW if( pTab && pTab->pSelect ){ pTab = 0; sqlite3ErrorMsg(&sParse, "cannot open view: %s", zTable); } #endif if( !pTab ){ if( sParse.zErrMsg ){ sqlite3_snprintf(sizeof(zErr), zErr, "%s", sParse.zErrMsg); } sqlite3_free(sParse.zErrMsg); rc = SQLITE_ERROR; (void)sqlite3SafetyOff(db); |
︙ | ︙ |
Changes to test/incrblob.test.
1 2 3 4 5 6 7 8 9 10 11 | # 2007 May 1 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # 2007 May 1 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # # $Id: incrblob.test,v 1.20 2008/04/24 09:49:55 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable {!autovacuum || !pragma || !incrblob} { finish_test |
︙ | ︙ | |||
255 256 257 258 259 260 261 262 263 264 265 266 267 268 | # 4.5 - Attempt to open an integer # 4.6 - Attempt to open a real value # 4.7 - Attempt to open an SQL null # # 4.8 - Attempt to open an indexed column for writing # 4.9 - Attempt to open an indexed column for reading (this works) # do_test incrblob-4.1 { set rc [catch { set ::blob [db incrblob blobs v 2] } msg ] list $rc $msg } {1 {no such rowid: 2}} do_test incrblob-4.2 { | > > > | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | # 4.5 - Attempt to open an integer # 4.6 - Attempt to open a real value # 4.7 - Attempt to open an SQL null # # 4.8 - Attempt to open an indexed column for writing # 4.9 - Attempt to open an indexed column for reading (this works) # # 4.11 - Attempt to open a column of a view. # 4.12 - Attempt to open a column of a virtual table. # do_test incrblob-4.1 { set rc [catch { set ::blob [db incrblob blobs v 2] } msg ] list $rc $msg } {1 {no such rowid: 2}} do_test incrblob-4.2 { |
︙ | ︙ | |||
328 329 330 331 332 333 334 | } {1 2 3 4 5 6 7 8 9} do_test incrblob-4.10 { set ::blob [db incrblob -readonly blobs k 3] set rc [catch { sqlite3_blob_read $::blob 10 100 } msg] list $rc $msg } {1 SQLITE_ERROR} | | > > > > > > > > > > > > > > > > > | 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | } {1 2 3 4 5 6 7 8 9} do_test incrblob-4.10 { set ::blob [db incrblob -readonly blobs k 3] set rc [catch { sqlite3_blob_read $::blob 10 100 } msg] list $rc $msg } {1 SQLITE_ERROR} do_test incrblob-4.10.2 { close $::blob } {} ifcapable view { do_test incrblob-4.11 { execsql { CREATE VIEW blobs_view AS SELECT k, v, i FROM blobs } set rc [catch { db incrblob blobs_view v 3 } msg] list $rc $msg } {1 {cannot open view: blobs_view}} } ifcapable vtab { register_echo_module [sqlite3_connection_pointer db] do_test incrblob-4.12 { execsql { CREATE VIRTUAL TABLE blobs_echo USING echo(blobs) } set rc [catch { db incrblob blobs_echo v 3 } msg] list $rc $msg } {1 {cannot open virtual table: blobs_echo}} } #------------------------------------------------------------------------ # incrblob-5.*: # # Test that opening a blob in an attached database works. # ifcapable attach { |
︙ | ︙ |