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

Fix a corner-case error in the new UPDATE FROM logic helpfully discovered

by OSSFuzz.

FossilOrigin-Name: 5cc200939d3a33566ddb858fc74c878acc72cfe5cf4c9b1d08e7b13e4d5ff566
This commit is contained in:
drh
2020-07-20 18:07:35 +00:00
parent a192807c13
commit 09cf569292
4 changed files with 27 additions and 9 deletions

View File

@@ -1138,7 +1138,14 @@ static void selectInnerLoop(
{
int i2 = pDest->iSDParm2;
int r1 = sqlite3GetTempReg(pParse);
sqlite3VdbeAddOp3(v, OP_MakeRecord,regResult+(i2<0),nResultCol-(i2<0),r1);
/* If the UPDATE FROM join is an aggregate that matches no rows, it
** might still be trying to return one row, because that is what
** aggregates do. Don't record that empty row in the output table. */
sqlite3VdbeAddOp2(v, OP_IsNull, regResult, iBreak); VdbeCoverage(v);
sqlite3VdbeAddOp3(v, OP_MakeRecord,
regResult+(i2<0), nResultCol-(i2<0), r1);
if( i2<0 ){
sqlite3VdbeAddOp3(v, OP_Insert, iParm, r1, regResult);
}else{