From: dan Date: Mon, 24 Dec 2018 13:34:36 +0000 (+0000) Subject: Change the way a comparison used to detect corrupt databases in fts3 is done X-Git-Tag: version-3.27.0~255 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=29e9af88484b2266189d694faa3eb3e69f0a7190;p=thirdparty%2Fsqlite.git Change the way a comparison used to detect corrupt databases in fts3 is done to avoid potential pointer overflow in 32-bit builds. FossilOrigin-Name: 95a9a39ff784b960b62dd6298e722a620ba3f9c8b76839a49bbef35d7bc84a8e --- diff --git a/ext/fts3/fts3_write.c b/ext/fts3/fts3_write.c index 07d73ab8bd..6b9295e9bf 100644 --- a/ext/fts3/fts3_write.c +++ b/ext/fts3/fts3_write.c @@ -1409,7 +1409,7 @@ static int fts3SegReaderNext( ** b-tree node. And that the final byte of the doclist is 0x00. If either ** of these statements is untrue, then the data structure is corrupt. */ - if( (&pReader->aNode[pReader->nNode] - pReader->aDoclist)nDoclist + if( pReader->nDoclist-(pReader->aDoclist-pReader->aNode) > pReader->nNode || (pReader->nPopulate==0 && pReader->aDoclist[pReader->nDoclist-1]) ){ return FTS_CORRUPT_VTAB; diff --git a/manifest b/manifest index 4ac2af14db..5dce7fd104 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Split\sthe\scode\sgeneration\sfor\sthe\sRHS\sof\sIN\soperators\sand\sfor\sSELECT\sand\nEXISTS\sexpressions\sinto\stwo\sseparate\ssubroutines,\sbecause\sthere\sis\snow\slittle\ncommonality\sbetween\sthose\sto\sfunctions.\sThis\sis\sintended\sto\shelp\smake\sthe\ncode\seasier\sto\sread\sand\smaintain. -D 2018-12-23T21:27:29.955 +C Change\sthe\sway\sa\scomparison\sused\sto\sdetect\scorrupt\sdatabases\sin\sfts3\sis\sdone\nto\savoid\spotential\spointer\soverflow\sin\s32-bit\sbuilds. +D 2018-12-24T13:34:36.984 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in d8b254f8bb81bab43c340d70d17dc3babab40fcc8a348c8255881f780a45fee6 @@ -98,7 +98,7 @@ F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3 F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004 F ext/fts3/fts3_unicode.c b1902e9ad47a6569fbb8ecb5ce52f20fe59b590d5c5e3bbdd56b10b03bdf632b F ext/fts3/fts3_unicode2.c e49f9e015f239bf5faf2f4fa483bbf1b08a9978f0ad1f31159d952f8b8a10d08 -F ext/fts3/fts3_write.c 8e67961f4452024b5b75c18aa46317e0f2ad30bf2c5c18381528d211cc10f90d +F ext/fts3/fts3_write.c 6b00abe4d46ec31f49e2ea82ad14d7314e5dbfcf8afabde597fb9b0dff087375 F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9 F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100 F ext/fts3/tool/fts3cov.sh c331d006359456cf6f8f953e37f2b9c7d568f3863f00bb5f7eb87fea4ac01b73 @@ -1792,7 +1792,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 6231485114eb07b258cd0e6e163ca05f7e9cf5664e071808fcb1329b33e4c4f5 -R 2a6002750376d4a69fc079d42ab7e257 -U drh -Z 5671bf9f2889b8158f9e3e76a5d3d072 +P 2b6494b1509f0d0189f98aa34c990eee99c775ff57826e79b2c5b0a12b4c97ad +R a02ab00644ca16cf9661dd1e6ee9ef5e +U dan +Z a6822b20c230c488499f3dd180c02a24 diff --git a/manifest.uuid b/manifest.uuid index 049844bee8..f23e83a210 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2b6494b1509f0d0189f98aa34c990eee99c775ff57826e79b2c5b0a12b4c97ad \ No newline at end of file +95a9a39ff784b960b62dd6298e722a620ba3f9c8b76839a49bbef35d7bc84a8e \ No newline at end of file