From: danielk1977 Date: Wed, 23 Jan 2008 15:44:51 +0000 (+0000) Subject: Fix a couple of segfaults that could occur after a malloc() failure in the SQL compil... X-Git-Tag: version-3.6.10~1430 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=15cdbebe08a7f6b3cdd1bd0e8c3b8b8ce5383f2b;p=thirdparty%2Fsqlite.git Fix a couple of segfaults that could occur after a malloc() failure in the SQL compiler. (CVS 4747) FossilOrigin-Name: 6bd8db3839d57a738cae2196679819186968b40e --- diff --git a/manifest b/manifest index 7c926fe455..e20aa9fec9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Testing\scoverage\senhancements\sto\ssqlite3_get_table()\sand\sto\sthe\sSELECT\ncode\sgenerator.\s(CVS\s4746) -D 2008-01-23T14:51:49 +C Fix\sa\scouple\sof\ssegfaults\sthat\scould\soccur\safter\sa\smalloc()\sfailure\sin\sthe\sSQL\scompiler.\s(CVS\s4747) +D 2008-01-23T15:44:51 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7 F Makefile.in bc2b5df3e3d0d4b801b824b7ef6dec43812b049b F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -132,7 +132,7 @@ F src/pragma.c 2bb8d6882b9a330e041acd05fb6aff5a01bf0a08 F src/prepare.c 1b0601ca3f97a9d253cc08697484e3045a1678e9 F src/printf.c eb27822ba2eec669161409ca31279a24c26ac910 F src/random.c 02ef38b469237482f1ea14a78b2087cfbaec48bd -F src/select.c 9c273d069d5051a4413cb55a578f01bd15f90bc8 +F src/select.c 8aa0f336afc707eed9acc110e71f5efbacf5a065 F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96 F src/shell.c ca06cb687c40a8bff6307b5fad41a0e86a0f8558 F src/sqlite.h.in 2a7e3776534bbe6ff2cdc058f3abebe91e7e429f @@ -367,7 +367,7 @@ F test/lock2.test 018b846f6f3b3b695fad07e317b7988442b556f4 F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9 F test/lock4.test f358fa835dff485d462072eee991111f09e87441 F test/main.test 82c222989e02ea09abd58d453828ffd71806b6bf -F test/malloc.test 010b60540ce24d90c00bcd46762f06beb80f165d +F test/malloc.test d596bd25b1d8c8a8192fdc91815b37cae3228a50 F test/malloc2.test bacb55551f6f4dc58c538589a8d3e29b127ef8d0 F test/malloc3.test 5d3839afd98bff92b82d13405f41c96e77ac2a6b F test/malloc4.test f0e5e0f639f61e2776a6c3f5308f836b3ad8b3c7 @@ -614,7 +614,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P 9f95d79daeb5e7f6fd62f3c896dae4d332121d1c -R 7c8b98078b7046bd6e4e654dd28d4eae -U drh -Z cc9f9cd8eb83f3c51b585ce1808ca1e8 +P 45c59802f6d35c7745b96c578ab43d5a336fe822 +R 23c7c27195b1f31b653e1bbd1b07f4e2 +U danielk1977 +Z 05ee4244fbaa32d388c5ec67cdef8a06 diff --git a/manifest.uuid b/manifest.uuid index 6fc6628f39..a9c67f964e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -45c59802f6d35c7745b96c578ab43d5a336fe822 \ No newline at end of file +6bd8db3839d57a738cae2196679819186968b40e \ No newline at end of file diff --git a/src/select.c b/src/select.c index 48925b59a8..49d179cf2c 100644 --- a/src/select.c +++ b/src/select.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** -** $Id: select.c,v 1.407 2008/01/23 14:51:50 drh Exp $ +** $Id: select.c,v 1.408 2008/01/23 15:44:51 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -1594,7 +1594,7 @@ static int processOrderGroupBy( sqlite3 *db = pParse->db; ExprList *pEList; - if( pOrderBy==0 ) return 0; + if( pOrderBy==0 || pParse->db->mallocFailed ) return 0; if( pOrderBy->nExpr>SQLITE_MAX_COLUMN ){ const char *zType = isOrder ? "ORDER" : "GROUP"; sqlite3ErrorMsg(pParse, "too many terms in %s BY clause", zType); @@ -1624,7 +1624,7 @@ static int processOrderGroupBy( sqlite3ExprDelete(pE); pE = sqlite3ExprDup(db, pEList->a[iCol-1].pExpr); pOrderBy->a[i].pExpr = pE; - if( pColl && flags ){ + if( pE && pColl && flags ){ pE->pColl = pColl; pE->flags |= flags; } diff --git a/test/malloc.test b/test/malloc.test index d2f5121718..47e2fa2d70 100644 --- a/test/malloc.test +++ b/test/malloc.test @@ -16,7 +16,7 @@ # to see what happens in the library if a malloc were to really fail # due to an out-of-memory situation. # -# $Id: malloc.test,v 1.55 2008/01/19 23:50:26 drh Exp $ +# $Id: malloc.test,v 1.56 2008/01/23 15:44:51 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -60,6 +60,7 @@ ifcapable bloblit&&subquery { SELECT avg(b) FROM t1 GROUP BY a HAVING b>20.0; DELETE FROM t1 WHERE a IN (SELECT min(a) FROM t1); SELECT count(*), group_concat(e) FROM t1; + SELECT b FROM t1 ORDER BY 1 COLLATE nocase; } }