Make sure the destination WhereLoop is left in a sane state when an

OOM fault occurs inside of whereLoopXfer().

FossilOrigin-Name: a99a53b81e29c9514b85318bea028d1667e5f760
This commit is contained in:
drh 2013-09-06 00:40:59 +00:00
parent 8ff2d9561a
commit 0d31dc37ac
3 changed files with 12 additions and 9 deletions

View File

@ -1,5 +1,5 @@
C When\spreparing\san\sUPDATE\sstatement,\savoid\sgenerating\sVDBE\scode\sfor\sthose\sforeign\skey\srelated\sactions\sand\sconstraint\schecks\sthat\smay\sbe\sseen\sto\sbe\sunnecessary\sby\sconsidering\sthe\ssubset\sof\stable\scolumns\spotentially\smodified\sby\sthe\sUPDATE.
D 2013-09-05T18:40:29.445
C Make\ssure\sthe\sdestination\sWhereLoop\sis\sleft\sin\sa\ssane\sstate\swhen\san\nOOM\sfault\soccurs\sinside\sof\swhereLoopXfer().
D 2013-09-06T00:40:59.250
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -290,7 +290,7 @@ F src/vtab.c 165ce0e797c2cd23badb104c9f2ae9042d6d942c
F src/wal.c 7dc3966ef98b74422267e7e6e46e07ff6c6eb1b4
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
F src/walker.c 4fa43583d0a84b48f93b1e88f11adf2065be4e73
F src/where.c 613993bd44f43a5d78f1e0068f3d7197f3133990
F src/where.c 06c249a5137575ecf4d527e5a1dadb1087e4375c
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6
@ -1111,7 +1111,7 @@ F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/wherecosttest.c f407dc4c79786982a475261866a161cd007947ae
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
P 8462fb43c275a70db59c4339650225deeadeef00
R d3b1cfd48ce8f1b63476cb1b87cb1fe9
U dan
Z ebec4296d6724df2f506ca7d4f2e487f
P e940b5de49baa1d6a4cf859fbbc0e0df86ac5dbf
R 27c19be948fb041fa8a271cfce7ac00b
U drh
Z 37cec8f35623233f7042fbd6abda9820

View File

@ -1 +1 @@
e940b5de49baa1d6a4cf859fbbc0e0df86ac5dbf
a99a53b81e29c9514b85318bea028d1667e5f760

View File

@ -4068,8 +4068,11 @@ static int whereLoopResize(sqlite3 *db, WhereLoop *p, int n){
** Transfer content from the second pLoop into the first.
*/
static int whereLoopXfer(sqlite3 *db, WhereLoop *pTo, WhereLoop *pFrom){
if( whereLoopResize(db, pTo, pFrom->nLTerm) ) return SQLITE_NOMEM;
whereLoopClearUnion(db, pTo);
if( whereLoopResize(db, pTo, pFrom->nLTerm) ){
memset(&pTo->u, 0, sizeof(pTo->u));
return SQLITE_NOMEM;
}
memcpy(pTo, pFrom, WHERE_LOOP_XFER_SZ);
memcpy(pTo->aLTerm, pFrom->aLTerm, pTo->nLTerm*sizeof(pTo->aLTerm[0]));
if( pFrom->wsFlags & WHERE_VIRTUALTABLE ){