From: drh Date: Thu, 30 Oct 2008 22:13:23 +0000 (+0000) Subject: Fix a faulty assert() in the merge implementation of the UNION operator. X-Git-Tag: version-3.6.10~325 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c0dc8256b0a60b6944cdc144d687309c956bec1;p=thirdparty%2Fsqlite.git Fix a faulty assert() in the merge implementation of the UNION operator. Ticket #3467. (CVS 5852) FossilOrigin-Name: cd1662e964d9c071a41038676c5a6ef2c990f1ac --- diff --git a/manifest b/manifest index e8069928db..5bad46d34a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\scrash\sthat\scan\sfollow\sa\smalloc\sfailure\sin\ssqlite3ValueFromExpr().\sTicket\s#3468.\s(CVS\s5851) -D 2008-10-30T17:21:13 +C Fix\sa\sfaulty\sassert()\sin\sthe\smerge\simplementation\sof\sthe\sUNION\soperator.\nTicket\s#3467.\s(CVS\s5852) +D 2008-10-30T22:13:23 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in da817da72422f9b876602c225fcd17d6ca4182f7 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -148,7 +148,7 @@ F src/prepare.c c7e00ed1b0bdcf699b1aad651247d4dc3d281b0b F src/printf.c 785f87120589c1db672e37c6eb1087c456e6f84d F src/random.c a87afbd598aa877e23ac676ee92fd8ee5c786a51 F src/resolve.c 266bb03d2b456fe68f5df2dd5687e7e88ff8088d -F src/select.c d910d7350df0d918e22286c5bfd39d4ea68ec813 +F src/select.c 59ffe26fe84e1f1f0bf8082dfa39f844c6a02f74 F src/shell.c d83b578a8ccdd3e0e7fef4388a0887ce9f810967 F src/sqlite.h.in f74e769732013f96d1ea71e4fe9a489c76bed785 F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17 @@ -427,7 +427,7 @@ F test/mallocF.test 2d5c590ebc2fc7f0dcebdf5aa8498b9aed69107e F test/mallocG.test 4584d0d8ddb8009f16ca0c8bab1fa37f6358efa2 F test/mallocH.test 79b65aed612c9b3ed2dcdaa727c85895fd1bfbdb F test/mallocI.test 6e24fe6444bd2999ccc81f984977b44c0d6e5591 -F test/mallocJ.test d7a6e82de88d194055ae715da50cc09179603282 +F test/mallocJ.test 5e7798d543cd837d6fd1c1d8086fe1867e705723 F test/malloc_common.tcl 984baeb6c6b185e798827d1187d426acc2bc4962 F test/manydb.test 8de36b8d33aab5ef295b11d9e95310aeded31af8 F test/memdb.test a67bda4ff90a38f2b19f6c7f95aa7289e051d893 @@ -652,7 +652,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P 4c6a90a16627b1664bf7f15ab40b440b3bd60b48 -R 18a1372ede481036089807fde4a470c0 -U danielk1977 -Z 8cc2bcfa926e2577f603891ab838a0a1 +P 0996783b1b7e6dda166565071cbd19f23e7edbbc +R 41c3494036b2c015e32affe1d847d6d3 +U drh +Z 9a404301611b14e1f4a10624e376859d diff --git a/manifest.uuid b/manifest.uuid index 661d3b2568..2311854e8f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0996783b1b7e6dda166565071cbd19f23e7edbbc \ No newline at end of file +cd1662e964d9c071a41038676c5a6ef2c990f1ac \ No newline at end of file diff --git a/src/select.c b/src/select.c index 5a8a6183be..917f40ccad 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.480 2008/10/07 19:53:14 drh Exp $ +** $Id: select.c,v 1.481 2008/10/30 22:13:23 drh Exp $ */ #include "sqliteInt.h" @@ -2144,7 +2144,7 @@ static int multiSelectOrderBy( regPrev = 0; }else{ int nExpr = p->pEList->nExpr; - assert( nOrderBy>=nExpr ); + assert( nOrderBy>=nExpr || db->mallocFailed ); regPrev = sqlite3GetTempRange(pParse, nExpr+1); sqlite3VdbeAddOp2(v, OP_Integer, 0, regPrev); pKeyDup = sqlite3DbMallocZero(db, diff --git a/test/mallocJ.test b/test/mallocJ.test index accafe4320..015e2093c6 100644 --- a/test/mallocJ.test +++ b/test/mallocJ.test @@ -12,7 +12,7 @@ # This test script checks malloc failures in LIMIT operations for # UPDATE/DELETE statements. # -# $Id: mallocJ.test,v 1.1 2008/10/10 13:34:30 shane Exp $ +# $Id: mallocJ.test,v 1.2 2008/10/30 22:13:23 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -20,7 +20,7 @@ source $testdir/malloc_common.tcl ifcapable {update_delete_limit} { - do_malloc_test mallocJ-4 -sqlprep { + do_malloc_test mallocJ-1 -sqlprep { DROP TABLE IF EXISTS t1; CREATE TABLE t1(x int, y int); INSERT INTO t1 VALUES(1,1); @@ -38,4 +38,15 @@ ifcapable {update_delete_limit} { } +# ticket #3467 +do_malloc_test mallocJ-2 -sqlprep { + CREATE TABLE t1(a,b); + INSERT INTO t1 VALUES(1,2); +} -sqlbody { + SELECT a, b, 'abc' FROM t1 + UNION + SELECT b, a, 'xyz' FROM t1 + ORDER BY 2, 3; +} + finish_test