From: danielk1977 Date: Fri, 13 Jan 2006 15:58:43 +0000 (+0000) Subject: Avoid parsing an entire record header when it is not required. (CVS 2940) X-Git-Tag: version-3.6.10~3227 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9792eeff950a125f3bf7fec8dcd6edda8974711d;p=thirdparty%2Fsqlite.git Avoid parsing an entire record header when it is not required. (CVS 2940) FossilOrigin-Name: 0de729d9144afba144811799f65e32140c14ef8a --- diff --git a/manifest b/manifest index 0e040c21aa..7d91834c49 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\ssure\sthe\sauthenticator\sdoes\snot\stry\sto\sauthenticate\scolumns\sin\nsubqueries.\s\s\sTicket\s#1607.\s(CVS\s2939) -D 2006-01-13T13:55:45 +C Avoid\sparsing\san\sentire\srecord\sheader\swhen\sit\sis\snot\srequired.\s(CVS\s2940) +D 2006-01-13T15:58:43 F Makefile.in ab3ffd8d469cef4477257169b82810030a6bb967 F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -87,14 +87,14 @@ F src/update.c 261d75c702c2852d1a64274d7c414485e6f2d177 F src/utf.c 5ab8ca05d4e9ec81174b010f01ab12a232f0087d F src/util.c b26be916edd1c991450cccc6503356c4f776598b F src/vacuum.c 21a3c7f6f7be86bb1182fbc3df416ad702435b9e -F src/vdbe.c 9e64780853ead129babe0c42462c7eb661e532f6 +F src/vdbe.c e2f081425c3b2be6e7ff25fbb2f3f70fa95413ee F src/vdbe.h 8729a4ee16ff9aeab2af9667df3cf300ff978e13 F src/vdbeInt.h 5451cf71f229e366ac543607c0a17f36e5737ea9 F src/vdbeapi.c afd3837cea0dec93dcb4724d073c84fa0da68e23 F src/vdbeaux.c 1d765d671ae31a067b2b064c3f193690f91eea62 F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5 F src/vdbemem.c dd08a0eea4868ac4a2d91fdec32424308b1db772 -F src/where.c 1e19c96cf8a55310118130ce251511be72e766f7 +F src/where.c 6885d655f3f7fb6455fcf5174c7119b1ce3ed860 F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42 F test/all.test a23fcbbf1f53515bde840d78732a6d94c673b327 F test/alter.test b94b640063e725d062b2997bd2810ac39195c718 @@ -340,7 +340,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 -P caa7da807d6578f7d8848978a7d3175b6ea1743b -R 6f79ad1aee69a2aa6006e2d298cd5d79 -U drh -Z b22000ffe605fffb14ba67c5c1828077 +P 55b7dfaf4d3a6d01fffdaf1707e88bcd215d7333 +R 07d8c70ff570eb317ee47042ddb86743 +U danielk1977 +Z 7bb864839753b74a0c8dfa1447111caa diff --git a/manifest.uuid b/manifest.uuid index 156aee407c..a05cca946c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -55b7dfaf4d3a6d01fffdaf1707e88bcd215d7333 \ No newline at end of file +0de729d9144afba144811799f65e32140c14ef8a \ No newline at end of file diff --git a/src/vdbe.c b/src/vdbe.c index fffd92e738..563fd7561a 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -43,7 +43,7 @@ ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** -** $Id: vdbe.c,v 1.527 2006/01/13 06:33:24 danielk1977 Exp $ +** $Id: vdbe.c,v 1.528 2006/01/13 15:58:43 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -1962,7 +1962,7 @@ case OP_Column: { /* If payloadSize is 0, then just push a NULL onto the stack. */ if( payloadSize==0 ){ - pTos->flags = MEM_Null; + assert( pTos->flags==MEM_Null ); break; } @@ -2051,11 +2051,11 @@ case OP_Column: { aOffset[i++] = 0; } - /* The header should end at the start of data and the data should - ** end at last byte of the record. If this is not the case then - ** we are dealing with a malformed record. + /* If we have read more header data than was contained in the header, + ** or if the end of the last field appears to be past the end of the + ** record, then we must be dealing with a corrupt database. */ - if( idx!=szHdr || offset!=payloadSize ){ + if( idx>szHdr || offset>payloadSize ){ rc = SQLITE_CORRUPT_BKPT; goto op_column_out; } diff --git a/src/where.c b/src/where.c index 207b4ebeff..35f319254e 100644 --- a/src/where.c +++ b/src/where.c @@ -16,7 +16,7 @@ ** so is applicable. Because this module is responsible for selecting ** indices, you might also think of this module as the "query optimizer". ** -** $Id: where.c,v 1.196 2006/01/13 13:01:19 danielk1977 Exp $ +** $Id: where.c,v 1.197 2006/01/13 15:58:43 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -1592,6 +1592,13 @@ WhereInfo *sqlite3WhereBegin( if( pTab->isTransient || pTab->pSelect ) continue; if( (pLevel->flags & WHERE_IDX_ONLY)==0 ){ sqlite3OpenTable(pParse, pTabItem->iCursor, iDb, pTab, OP_OpenRead); + if( pTab->nCol<(sizeof(Bitmask)*8) ){ + Bitmask b = pTabItem->colUsed; + int n = 0; + for(; b; b=b>>1, n++); + sqlite3VdbeChangeP2(v, sqlite3VdbeCurrentAddr(v)-1, n); + assert( n<=pTab->nCol ); + } }else{ sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName); }