diff options
author | drh <drh@noemail.net> | 2018-04-19 13:52:39 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2018-04-19 13:52:39 +0000 |
commit | bb6b1ca73d67016fe18a083d157071e984a2d362 (patch) | |
tree | ff24499eac387b1895e493a954423f7be6764c06 /src | |
parent | 5e3a6ebf34aac81972b2ca9809494b8e7485c8d4 (diff) | |
download | sqlite-bb6b1ca73d67016fe18a083d157071e984a2d362.tar.gz sqlite-bb6b1ca73d67016fe18a083d157071e984a2d362.zip |
Fix a problem in the new upsert implemention, discovered by OSSFuzz.
FossilOrigin-Name: b6d5ea59fe83716f464e408b7eef0310c6d30b3493e3f966362db2e30b36e821
Diffstat (limited to 'src')
-rw-r--r-- | src/insert.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/insert.c b/src/insert.c index 2a6d74db2..e522d4664 100644 --- a/src/insert.c +++ b/src/insert.c @@ -1471,15 +1471,6 @@ void sqlite3GenerateConstraintChecks( onError = OE_Abort; } - if( isUpdate ){ - /* pkChng!=0 does not mean that the rowid has changed, only that - ** it might have changed. Skip the conflict logic below if the rowid - ** is unchanged. */ - sqlite3VdbeAddOp3(v, OP_Eq, regNewData, addrRowidOk, regOldData); - sqlite3VdbeChangeP5(v, SQLITE_NOTNULL); - VdbeCoverage(v); - } - /* figure out whether or not upsert applies in this case */ if( pUpsert && pUpsert->pUpsertIdx==0 ){ if( pUpsert->pUpsertSet==0 ){ @@ -1506,6 +1497,15 @@ void sqlite3GenerateConstraintChecks( sAddr.ipkTop = sqlite3VdbeAddOp0(v, OP_Goto)+1; } + if( isUpdate ){ + /* pkChng!=0 does not mean that the rowid has changed, only that + ** it might have changed. Skip the conflict logic below if the rowid + ** is unchanged. */ + sqlite3VdbeAddOp3(v, OP_Eq, regNewData, addrRowidOk, regOldData); + sqlite3VdbeChangeP5(v, SQLITE_NOTNULL); + VdbeCoverage(v); + } + /* Check to see if the new rowid already exists in the table. Skip ** the following conflict logic if it does not. */ VdbeNoopComment((v, "uniqueness check for ROWID")); |