From: drh <> Date: Sat, 26 Feb 2022 14:39:08 +0000 (+0000) Subject: Allow the OP_Column opcode to read rows that are larger than X-Git-Tag: version-3.39.0~365 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9090df6f739dec4fb1663a4c76561b4491144256;p=thirdparty%2Fsqlite.git Allow the OP_Column opcode to read rows that are larger than SQLITE_LIMIT_LENGTH as long as the specific field being read out is less than or equal to SQLITE_LIMIT_LENGTH. FossilOrigin-Name: 1bf4848995ab094ad84ef4aa1563bce641d5acf7335fb4630c892b16cf7d7edd --- diff --git a/manifest b/manifest index 892f8fb779..14b7b855ce 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Revise\sthe\sinitialization\sprocessing\sfor\sOP_Column\sto\smake\sit\sabout\n1.8\smillion\scycles\sfaster. -D 2022-02-25T20:11:59.160 +C Allow\sthe\sOP_Column\sopcode\sto\sread\srows\sthat\sare\slarger\sthan\nSQLITE_LIMIT_LENGTH\sas\slong\sas\sthe\sspecific\sfield\sbeing\sread\sout\sis\nless\sthan\sor\sequal\sto\sSQLITE_LIMIT_LENGTH. +D 2022-02-26T14:39:08.859 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -624,7 +624,7 @@ F src/upsert.c 8789047a8f0a601ea42fa0256d1ba3190c13746b6ba940fe2d25643a7e991937 F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0 F src/util.c 602fe229f32a96ceccae4f40824129669582096f7c355f53dbac156c9fecef23 F src/vacuum.c 6c38ddc52f0619865c91dae9c441d4d48bf3040d7dc1bc5b22da1e45547ed0b3 -F src/vdbe.c e3947ae70531c7e26fdca3da379bcb1aaad349dc1daad9841a11dd78f40e4705 +F src/vdbe.c 2dd9dc73c6e99db958550d1b66ea35046ff3d95ee2c752f41cf90a73ca742d25 F src/vdbe.h a1d0e3b934e835e73edd146f2e7c4eadb711b5c9875c18159a57483fd78e550e F src/vdbeInt.h de2348c1643c1ac5bf0932452cbb708f52f52d8b4e29b667abdcfd4bacbf6aa6 F src/vdbeapi.c 8863ffb5a7bac42fe9a68aaa3526ee29fc18fb02a9b27188b756de41e33856e9 @@ -1944,8 +1944,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 4e269902094e8f9d852e5fc852e473167048fdeb9034f1fb1436f6df205de926 -R 8636bb1bb599a232ab53a80eb27f1dd2 +P 3b7259ebd5b9b1f75577521c4d0d96f5503d302a513b20a0b17dbe8c3823dd33 +R a170b2aecc18c2441545989ed3dec05a U drh -Z 2c3c6e68626da40fc12f58f70cf79dcd +Z 8d66f3f471c1337d94ff51594a5973cc # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 45a49d23f0..cfe6a25611 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3b7259ebd5b9b1f75577521c4d0d96f5503d302a513b20a0b17dbe8c3823dd33 \ No newline at end of file +1bf4848995ab094ad84ef4aa1563bce641d5acf7335fb4630c892b16cf7d7edd \ No newline at end of file diff --git a/src/vdbe.c b/src/vdbe.c index d1e54b8f9e..4a31555795 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -2727,15 +2727,11 @@ op_column_restart: pC->aRow = sqlite3BtreePayloadFetch(pCrsr, &pC->szRow); assert( pC->szRow<=pC->payloadSize ); assert( pC->szRow<=65536 ); /* Maximum page size is 64KiB */ - if( pC->payloadSize > (u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){ - goto too_big; - } } pC->cacheStatus = p->cacheCtr; pC->iHdrOffset = getVarint32(pC->aRow, aOffset[0]); pC->nHdrParsed = 0; - if( pC->szRowaRow does not have to hold the entire row, but it does at least ** need to cover the header of the record. If pC->aRow does not contain @@ -2888,6 +2884,7 @@ op_column_restart: pDest->n = len = (t-12)/2; pDest->enc = encoding; if( pDest->szMalloc < len+2 ){ + if( len>db->aLimit[SQLITE_LIMIT_LENGTH] ) goto too_big; pDest->flags = MEM_Null; if( sqlite3VdbeMemGrow(pDest, len+2, 0) ) goto no_mem; }else{ @@ -2920,6 +2917,7 @@ op_column_restart: */ sqlite3VdbeSerialGet((u8*)sqlite3CtypeMap, t, pDest); }else{ + if( len>db->aLimit[SQLITE_LIMIT_LENGTH] ) goto too_big; rc = sqlite3VdbeMemFromBtree(pC->uc.pCursor, aOffset[p2], len, pDest); if( rc!=SQLITE_OK ) goto abort_due_to_error; sqlite3VdbeSerialGet((const u8*)pDest->z, t, pDest);