1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Add assert() statements to validate access to the SrcItem.u1.nRow union member.

FossilOrigin-Name: 21f616d9b948efca441f8d45d0a95f4c052ce8b6daec7fa582ad9a00b82ca570
This commit is contained in:
drh
2024-03-18 13:31:24 +00:00
parent 871786b792
commit ac7c6f5854
5 changed files with 17 additions and 14 deletions

View File

@@ -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++;
}

View File

@@ -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{

View File

@@ -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 */