/ Check-in [a0ab42f7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix an out-of-bounds array reference in the generated column logic. Problem discovered by valgrind.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a0ab42f779b9a96f4e43879210dfaba8fa593de77fc0ec0e2e6f116d9301ea59
User & Date: drh 2019-11-21 20:10:31
Context
2019-11-21
20:24
Add all fuzz-test cases received from Yongheng Chen and Rui Zhong. Also fix a minor problem in gencol1.test cases. check-in: ac080432 user: drh tags: trunk
20:10
Fix an out-of-bounds array reference in the generated column logic. Problem discovered by valgrind. check-in: a0ab42f7 user: drh tags: trunk
19:37
Whenever a generated column is used, assume that all columns are used. check-in: 6601da58 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/insert.c.

198
199
200
201
202
203
204
205
206
207
208

209
210
211
212
213
214
215
    }
#endif
  }
  return 0;
}

/* This walker callback will compute the union of colFlags flags for all
** references columns in a CHECK constraint or generated column expression.
*/
static int exprColumnFlagUnion(Walker *pWalker, Expr *pExpr){
  if( pExpr->op==TK_COLUMN ){

    pWalker->eCode |= pWalker->u.pTab->aCol[pExpr->iColumn].colFlags;
  }
  return WRC_Continue;
}

#ifndef SQLITE_OMIT_GENERATED_COLUMNS
/*







|


|
>







198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
    }
#endif
  }
  return 0;
}

/* This walker callback will compute the union of colFlags flags for all
** referenced columns in a CHECK constraint or generated column expression.
*/
static int exprColumnFlagUnion(Walker *pWalker, Expr *pExpr){
  if( pExpr->op==TK_COLUMN && pExpr->iColumn>=0 ){
    assert( pExpr->iColumn < pWalker->u.pTab->nCol );
    pWalker->eCode |= pWalker->u.pTab->aCol[pExpr->iColumn].colFlags;
  }
  return WRC_Continue;
}

#ifndef SQLITE_OMIT_GENERATED_COLUMNS
/*