summaryrefslogtreecommitdiffstats
path: root/lib/libsqlite3/src/select.c
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2012-05-22 09:02:29 +0000
committerespie <espie@openbsd.org>2012-05-22 09:02:29 +0000
commitf962b6f71abebd72afa58d78eab055d750d49d0c (patch)
tree490fe4a0a2c05408cd845d4a35f25c6c8f35c9a3 /lib/libsqlite3/src/select.c
parentFix ftell() to return EOVERFLOW if the file offset is greater than (diff)
downloadwireguard-openbsd-f962b6f71abebd72afa58d78eab055d750d49d0c.tar.xz
wireguard-openbsd-f962b6f71abebd72afa58d78eab055d750d49d0c.zip
import sqlite 3.7.12 (tested by landry@)
Diffstat (limited to 'lib/libsqlite3/src/select.c')
-rw-r--r--lib/libsqlite3/src/select.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/libsqlite3/src/select.c b/lib/libsqlite3/src/select.c
index 3efe014d8b6..835d9fd9ccb 100644
--- a/lib/libsqlite3/src/select.c
+++ b/lib/libsqlite3/src/select.c
@@ -1258,9 +1258,17 @@ static int selectColumnsFromExprList(
char *zName; /* Column name */
int nName; /* Size of name in zName[] */
- *pnCol = nCol = pEList ? pEList->nExpr : 0;
- aCol = *paCol = sqlite3DbMallocZero(db, sizeof(aCol[0])*nCol);
- if( aCol==0 ) return SQLITE_NOMEM;
+ if( pEList ){
+ nCol = pEList->nExpr;
+ aCol = sqlite3DbMallocZero(db, sizeof(aCol[0])*nCol);
+ testcase( aCol==0 );
+ }else{
+ nCol = 0;
+ aCol = 0;
+ }
+ *pnCol = nCol;
+ *paCol = aCol;
+
for(i=0, pCol=aCol; i<nCol; i++, pCol++){
/* Get an appropriate name for the column
*/
@@ -2843,7 +2851,8 @@ static int flattenSubquery(
/* Authorize the subquery */
pParse->zAuthContext = pSubitem->zName;
- sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0);
+ TESTONLY(i =) sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0);
+ testcase( i==SQLITE_DENY );
pParse->zAuthContext = zSavedAuthContext;
/* If the sub-query is a compound SELECT statement, then (by restrictions
@@ -4228,7 +4237,7 @@ int sqlite3Select(
int r2;
r2 = sqlite3ExprCodeGetColumn(pParse,
- pCol->pTab, pCol->iColumn, pCol->iTable, r1);
+ pCol->pTab, pCol->iColumn, pCol->iTable, r1, 0);
if( r1!=r2 ){
sqlite3VdbeAddOp2(v, OP_SCopy, r2, r1);
}