From c1547d1f7acfdf7502f743529c6c9a1b7aefcf60 Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 28 Aug 2024 19:13:16 +0000 Subject: [PATCH] Do not allow sqlite3_blob_open() to work on a any table that contains generated columns, even columns of the table which are not generated themselves, because such columns might be part of the expression of a STORED column. This restriction could be relaxed some, but that would be a lot of code for something that nobody ever uses. FossilOrigin-Name: 6e84947123339f0ea2b7dabc6134a621eed09317f81647f15870ed50a0f7d1bc --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/vdbeblob.c | 5 +++++ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 717ed83794..d7b2d80921 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sdropped\serror\scode\sin\sfts5. -D 2024-08-28T15:54:46.677 +C Do\snot\sallow\ssqlite3_blob_open()\sto\swork\son\sa\sany\stable\sthat\scontains\ngenerated\scolumns,\seven\scolumns\sof\sthe\stable\swhich\sare\snot\sgenerated\sthemselves,\nbecause\ssuch\scolumns\smight\sbe\spart\sof\sthe\sexpression\sof\sa\sSTORED\scolumn.\nThis\srestriction\scould\sbe\srelaxed\ssome,\sbut\sthat\swould\sbe\sa\slot\sof\scode\nfor\ssomething\sthat\snobody\sever\suses. +D 2024-08-28T19:13:16.654 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -841,7 +841,7 @@ F src/vdbe.h c2549a215898a390de6669cfa32adba56f0d7e17ba5a7f7b14506d6fd5f0c36a F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c F src/vdbeapi.c 80235ac380e9467fec1cb0883354d841f2a771976e766995f7e0c77f845406df F src/vdbeaux.c 25d685cafe119ff890c94345e884ea558a6b5d823bfa52ba708eb8ff3c70aa71 -F src/vdbeblob.c 13f9287b55b6356b4b1845410382d6bede203ceb29ef69388a4a3d007ffacbe5 +F src/vdbeblob.c 255be187436da38b01f276c02e6a08103489bbe2a7c6c21537b7aecbe0e1f797 F src/vdbemem.c 831a244831eaa45335f9ae276b50a7a82ee10d8c46c2c72492d4eb8c98d94d89 F src/vdbesort.c d0a3c7056c081703c8b6d91ad60f17da5e062a5c64bf568ed0fa1b5f4cae311f F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823 @@ -2211,8 +2211,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P eb016f66ea2c7ebacf8c57495843db3414602d062e4a430f2cc603c88b10c3f9 -R 78d4e3d98d20e086c6528776d2d5c051 -U dan -Z 1a3069fd43dc36b1a74436c6f020d339 +P df55502e4f412e5b1daccf82f11fa4eb932047d9972dcd16e36be00cf09f78e1 +R e1af11959b2bec73273fe58897c14052 +U drh +Z 762ce3d8ddc624dbf22ecdf6a6f25bea # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 183857bc4a..aec5cf28d8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -df55502e4f412e5b1daccf82f11fa4eb932047d9972dcd16e36be00cf09f78e1 +6e84947123339f0ea2b7dabc6134a621eed09317f81647f15870ed50a0f7d1bc diff --git a/src/vdbeblob.c b/src/vdbeblob.c index 522447dbc1..6cb36da37a 100644 --- a/src/vdbeblob.c +++ b/src/vdbeblob.c @@ -167,6 +167,11 @@ int sqlite3_blob_open( pTab = 0; sqlite3ErrorMsg(&sParse, "cannot open table without rowid: %s", zTable); } + if( pTab && (pTab->tabFlags&TF_HasGenerated)!=0 ){ + pTab = 0; + sqlite3ErrorMsg(&sParse, "cannot open table with generated columns: %s", + zTable); + } #ifndef SQLITE_OMIT_VIEW if( pTab && IsView(pTab) ){ pTab = 0;