From: danielk1977 Date: Thu, 24 Apr 2008 09:49:55 +0000 (+0000) Subject: Ensure that it is not possible to open either virtual table or view columns using... X-Git-Tag: version-3.6.10~1136 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=36961ed23f377f3f2a13b9350c66490391af8f19;p=thirdparty%2Fsqlite.git Ensure that it is not possible to open either virtual table or view columns using the blob API. Ticket #3078. (CVS 5041) FossilOrigin-Name: 6039328fe05aaf9380d545e84dfabccb32a4d8ea --- diff --git a/manifest b/manifest index e2cfef0aaa..6baa1617a5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Minor\schange\sto\scomment\son\ssqlite3_blob_read().\sNo\scode\schanges.\sTicket\s#3072.\s(CVS\s5040) -D 2008-04-24T08:56:54 +C Ensure\sthat\sit\sis\snot\spossible\sto\sopen\seither\svirtual\stable\sor\sview\scolumns\susing\sthe\sblob\sAPI.\sTicket\s#3078.\s(CVS\s5041) +D 2008-04-24T09:49:55 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7 F Makefile.in 25b3282a4ac39388632c2fb0e044ff494d490952 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -179,7 +179,7 @@ F src/vdbe.h bfd84bda447f39cb599302c7ec85067dae20453c F src/vdbeInt.h 05316345da487b0cf540482576f9ae3337d133cd F src/vdbeapi.c 0e1b5a808bb0e556f2a975eb7d11fd3153e922bf F src/vdbeaux.c f18c0d2c47877d2ac7bdbf694ecd7b031d43b43a -F src/vdbeblob.c cc713c142c3d4952b380c98ee035f850830ddbdb +F src/vdbeblob.c 554736781ee273a8089c776e96bdb53e66f57ce6 F src/vdbefifo.c a30c237b2a3577e1415fb6e288cbb6b8ed1e5736 F src/vdbemem.c 237e61216381998ff71c6431e5e7bd03386f6225 F src/vtab.c f5e78bf73df3b0c1b53861109c1b2e0800b108cc @@ -331,7 +331,7 @@ F test/icu.test e6bfae7f625c88fd14df6f540fe835bdfc1e4329 F test/in.test 763a29007a4850d611ac4441bfa488fb9969ad30 F test/in2.test b1f447f4f0f67e9f83ff931e7e2e30873f9ea055 F test/in3.test dc62b080ed79898121c61c91118b4d1e111f1438 -F test/incrblob.test 529eeddb1bac919a17929b768ca2d04732f55847 +F test/incrblob.test 4455fffd08b2f9418a9257e18b135d72273eff3e F test/incrblob_err.test 5273097dc7c97f9b7008423a6ffd5c80d21923cb F test/incrvacuum.test 1a2b0bddc76629afeb41e3d8ea3e4563982d16b9 F test/incrvacuum2.test a958e378c193c4012cb3787804d863487f1dfad1 @@ -635,7 +635,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P 3cba1166076bf0506597e2d7686a271922817668 -R fa050ac165aaa728060330a28db7ce29 +P adb4bc5a7dd56e625b20c48a7416f2b3480f4de1 +R c0a5af2eeceba3da393758a0d20464af U danielk1977 -Z 77b3fb43d649518a5e8580bd41d6f27e +Z 4057dbaa526fb9661eeca50f7e5178e4 diff --git a/manifest.uuid b/manifest.uuid index d991eedaf3..b2d5fee461 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -adb4bc5a7dd56e625b20c48a7416f2b3480f4de1 \ No newline at end of file +6039328fe05aaf9380d545e84dfabccb32a4d8ea \ No newline at end of file diff --git a/src/vdbeblob.c b/src/vdbeblob.c index 1d456ad314..6b5a19dd73 100644 --- a/src/vdbeblob.c +++ b/src/vdbeblob.c @@ -12,7 +12,7 @@ ** ** This file contains code used to implement incremental BLOB I/O. ** -** $Id: vdbeblob.c,v 1.21 2008/03/25 09:47:35 danielk1977 Exp $ +** $Id: vdbeblob.c,v 1.22 2008/04/24 09:49:55 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -104,6 +104,16 @@ int sqlite3_blob_open( 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); diff --git a/test/incrblob.test b/test/incrblob.test index 0a09fe9815..cb64eeaf2d 100644 --- a/test/incrblob.test +++ b/test/incrblob.test @@ -9,7 +9,7 @@ # #*********************************************************************** # -# $Id: incrblob.test,v 1.19 2008/04/16 23:39:26 drh Exp $ +# $Id: incrblob.test,v 1.20 2008/04/24 09:49:55 danielk1977 Exp $ # set testdir [file dirname $argv0] @@ -259,6 +259,9 @@ catch {close $::blob} # 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] @@ -332,10 +335,27 @@ do_test incrblob-4.10 { set rc [catch { sqlite3_blob_read $::blob 10 100 } msg] list $rc $msg } {1 SQLITE_ERROR} -do_test incrblob-4.11 { +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.*: #