From: drh Date: Fri, 6 Sep 2013 00:40:59 +0000 (+0000) Subject: Make sure the destination WhereLoop is left in a sane state when an X-Git-Tag: version-3.8.1~91 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0d31dc37ac2a659fca1058c16928a29ccaca3ab4;p=thirdparty%2Fsqlite.git Make sure the destination WhereLoop is left in a sane state when an OOM fault occurs inside of whereLoopXfer(). FossilOrigin-Name: a99a53b81e29c9514b85318bea028d1667e5f760 --- diff --git a/manifest b/manifest index 60cf6a27a2..f9d32711c6 100644 --- a/manifest +++ b/manifest @@ -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 diff --git a/manifest.uuid b/manifest.uuid index 1ea65c845e..dd8735e5d7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e940b5de49baa1d6a4cf859fbbc0e0df86ac5dbf \ No newline at end of file +a99a53b81e29c9514b85318bea028d1667e5f760 \ No newline at end of file diff --git a/src/where.c b/src/where.c index 0f6cffb042..3c8a1eaac6 100644 --- a/src/where.c +++ b/src/where.c @@ -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 ){