aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2021-01-30 12:07:32 +0000
committerdrh <>2021-01-30 12:07:32 +0000
commit0166df0bdad64754cb72f205a823575dae7b45ea (patch)
tree76c59282ff5f1acac78772ae11a95bfb81d926cc /src
parentcf4108bbc687170edaeaed2548524bec3b63b5eb (diff)
downloadsqlite-0166df0bdad64754cb72f205a823575dae7b45ea.tar.gz
sqlite-0166df0bdad64754cb72f205a823575dae7b45ea.zip
Fix a obsolete assert() in the bytecode engine. Improved OOM detection
in sqlite3AddReturning(). FossilOrigin-Name: 138b10d54a83e1e7d5b3cdbe593a5073b05e632d1823e1b74d85835435b9ee3d
Diffstat (limited to 'src')
-rw-r--r--src/build.c5
-rw-r--r--src/vdbe.c9
2 files changed, 9 insertions, 5 deletions
diff --git a/src/build.c b/src/build.c
index e9e35333c..b0dac9965 100644
--- a/src/build.c
+++ b/src/build.c
@@ -1292,7 +1292,10 @@ void sqlite3AddReturning(Parse *pParse, ExprList *pList){
pRet->retSel.pSrc = (SrcList*)&pRet->retSrcList;
pHash = &(db->aDb[1].pSchema->trigHash);
assert( sqlite3HashFind(pHash, RETURNING_TRIGGER)==0 );
- sqlite3HashInsert(pHash, "sqlite_returning", &pRet->retTrig);
+ if( sqlite3HashInsert(pHash, "sqlite_returning", &pRet->retTrig)
+ ==&pRet->retTrig ){
+ sqlite3OomFault(db);
+ }
}
/*
diff --git a/src/vdbe.c b/src/vdbe.c
index 3a00515e5..d38d9a068 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -1470,9 +1470,10 @@ case OP_ResultRow: {
goto abort_due_to_error;
}
- /* If the SQLITE_CountRows flag is set in sqlite3.flags mask, then
- ** DML statements invoke this opcode to return the number of rows
- ** modified to the user. This is the only way that a VM that
+ /* DML statements can invoke this opcode to return the number of rows
+ ** modified to the user if the "PRAGMA count_changes=ON" pragma has been
+ ** run. DML statement triggers can invoke this satement to implement
+ ** the RETURNING clause. Thess are the only ways that a VM that
** opens a statement transaction may invoke this opcode.
**
** In case this is such a statement, close any statement transaction
@@ -1485,7 +1486,7 @@ case OP_ResultRow: {
** The statement transaction is never a top-level transaction. Hence
** the RELEASE call below can never fail.
*/
- assert( p->iStatement==0 || db->flags&SQLITE_CountRows );
+ assert( p->iStatement==0 || db->flags&SQLITE_CountRows || p->pFrame );
rc = sqlite3VdbeCloseStatement(p, SAVEPOINT_RELEASE);
assert( rc==SQLITE_OK );