1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Issue an error message and quit (rather than overflowing a reference counter)

if the number of references to a table exceeds the maximum due to nested
UNION views.  Fix for ticket [d58ccbb3f1].

FossilOrigin-Name: c2462a95ed8e1e69886681400d673207d906bf1b
This commit is contained in:
drh
2013-01-28 19:00:20 +00:00
parent 173ba0998c
commit d2a5623866
6 changed files with 52 additions and 13 deletions

View File

@@ -3343,6 +3343,12 @@ static int selectExpander(Walker *pWalker, Select *p){
assert( pFrom->pTab==0 );
pFrom->pTab = pTab = sqlite3LocateTableItem(pParse, 0, pFrom);
if( pTab==0 ) return WRC_Abort;
if( pTab->nRef==0xffff ){
sqlite3ErrorMsg(pParse, "too many references to \"%s\": max 65535",
pTab->zName);
pFrom->pTab = 0;
return WRC_Abort;
}
pTab->nRef++;
#if !defined(SQLITE_OMIT_VIEW) || !defined (SQLITE_OMIT_VIRTUALTABLE)
if( pTab->pSelect || IsVirtual(pTab) ){