aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2024-03-18 13:31:24 +0000
committerdrh <>2024-03-18 13:31:24 +0000
commitac7c6f58540e07a1db2cda5ed58b5fe06fc23dd2 (patch)
treea34af40fc4a8bbadf407c968369e1210a3131235 /src
parent871786b7927bc101e25e38d1c446cecd55939ed4 (diff)
downloadsqlite-ac7c6f58540e07a1db2cda5ed58b5fe06fc23dd2.tar.gz
sqlite-ac7c6f58540e07a1db2cda5ed58b5fe06fc23dd2.zip
Add assert() statements to validate access to the SrcItem.u1.nRow union member.
FossilOrigin-Name: 21f616d9b948efca441f8d45d0a95f4c052ce8b6daec7fa582ad9a00b82ca570
Diffstat (limited to 'src')
-rw-r--r--src/insert.c2
-rw-r--r--src/printf.c1
-rw-r--r--src/sqliteInt.h10
3 files changed, 8 insertions, 5 deletions
diff --git a/src/insert.c b/src/insert.c
index 7256281fd..be558be78 100644
--- a/src/insert.c
+++ b/src/insert.c
@@ -698,7 +698,6 @@ Select *sqlite3MultiValues(Parse *pParse, Select *pLeft, ExprList *pRow){
}else{
SrcItem *p = 0; /* SrcItem that reads from co-routine */
-
if( pLeft->pSrc->nSrc==0 ){
/* Co-routine has not yet been started and the special Select object
** that accesses the co-routine has not yet been created. This block
@@ -742,6 +741,7 @@ Select *sqlite3MultiValues(Parse *pParse, Select *pLeft, ExprList *pRow){
}
}else{
p = &pLeft->pSrc->a[0];
+ assert( !p->fg.isTabFunc && !p->fg.isIndexedBy );
p->u1.nRow++;
}
diff --git a/src/printf.c b/src/printf.c
index 0aea74e89..eb22ee320 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -861,6 +861,7 @@ void sqlite3_str_vappendf(
if( pSel->selFlags & SF_NestedFrom ){
sqlite3_str_appendf(pAccum, "(join-%u)", pSel->selId);
}else if( pSel->selFlags & SF_MultiValue ){
+ assert( !pItem->fg.isTabFunc && !pItem->fg.isIndexedBy );
sqlite3_str_appendf(pAccum, "%u-ROW VALUES CLAUSE",
pItem->u1.nRow);
}else{
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 01a512649..8d18bfdfb 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -3270,10 +3270,12 @@ struct IdList {
**
** Union member validity:
**
-** u1.zIndexedBy fg.isIndexedBy && !fg.isTabFunc
-** u1.pFuncArg fg.isTabFunc && !fg.isIndexedBy
-** u2.pIBIndex fg.isIndexedBy && !fg.isCte
-** u2.pCteUse fg.isCte && !fg.isIndexedBy
+** u1.zIndexedBy fg.isIndexedBy && !fg.isTabFunc
+** u1.pFuncArg fg.isTabFunc && !fg.isIndexedBy
+** u1.nRow !fg.isTabFunc && !fg.isIndexedBy
+**
+** u2.pIBIndex fg.isIndexedBy && !fg.isCte
+** u2.pCteUse fg.isCte && !fg.isIndexedBy
*/
struct SrcItem {
Schema *pSchema; /* Schema to which this item is fixed */