1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Avoid indexing off the front end of an array when creating a view with

two or more blank column names in the SELECT statement that defines the view.

FossilOrigin-Name: 554501f158534f9c27fd51900589c2ab7cf300d8
This commit is contained in:
drh
2014-03-04 21:19:51 +00:00
parent 052c6784ee
commit 19c6d96aec
4 changed files with 23 additions and 10 deletions

View File

@@ -1522,7 +1522,7 @@ static int selectColumnsFromExprList(
char *zNewName;
int k;
for(k=nName-1; k>1 && sqlite3Isdigit(zName[k]); k--){}
if( zName[k]==':' ) nName = k;
if( k>=0 && zName[k]==':' ) nName = k;
zName[nName] = 0;
zNewName = sqlite3MPrintf(db, "%s:%d", zName, ++cnt);
sqlite3DbFree(db, zName);