Fix a case where fts3 was erroneously reporting corruption.

FossilOrigin-Name: e6c7683c7503ac743d1d476c60c31f887b7ad829e26e812c25acdd4366044db8
This commit is contained in:
dan 2021-03-03 16:00:26 +00:00
parent fad1ad0526
commit c6920cdb0c
3 changed files with 26 additions and 27 deletions

View File

@ -4335,27 +4335,26 @@ static int fts3IncrmergeLoad(
while( reader.aNode && rc==SQLITE_OK ) rc = nodeReaderNext(&reader);
blobGrowBuffer(&pNode->key, reader.term.n, &rc);
if( rc==SQLITE_OK ){
if( reader.term.n<=0 ){
rc = FTS_CORRUPT_VTAB;
}else{
assert_fts3_nc( reader.term.n>0 || reader.aNode==0 );
if( reader.term.n>0 ){
memcpy(pNode->key.a, reader.term.a, reader.term.n);
pNode->key.n = reader.term.n;
if( i>0 ){
char *aBlock = 0;
int nBlock = 0;
pNode = &pWriter->aNodeWriter[i-1];
pNode->iBlock = reader.iChild;
rc = sqlite3Fts3ReadBlock(p, reader.iChild, &aBlock, &nBlock,0);
blobGrowBuffer(&pNode->block,
MAX(nBlock, p->nNodeSize)+FTS3_NODE_PADDING, &rc
);
if( rc==SQLITE_OK ){
memcpy(pNode->block.a, aBlock, nBlock);
pNode->block.n = nBlock;
memset(&pNode->block.a[nBlock], 0, FTS3_NODE_PADDING);
}
sqlite3_free(aBlock);
}
pNode->key.n = reader.term.n;
if( i>0 ){
char *aBlock = 0;
int nBlock = 0;
pNode = &pWriter->aNodeWriter[i-1];
pNode->iBlock = reader.iChild;
rc = sqlite3Fts3ReadBlock(p, reader.iChild, &aBlock, &nBlock,0);
blobGrowBuffer(&pNode->block,
MAX(nBlock, p->nNodeSize)+FTS3_NODE_PADDING, &rc
);
if( rc==SQLITE_OK ){
memcpy(pNode->block.a, aBlock, nBlock);
pNode->block.n = nBlock;
memset(&pNode->block.a[nBlock], 0, FTS3_NODE_PADDING);
}
sqlite3_free(aBlock);
}
}
}

View File

@ -1,5 +1,5 @@
C Fix\sa\sharmless\sassertion\sfault\sresulting\sfrom\s[6e6b3729e0549de0]\sthat\swas\ndiscovered\sby\sdbsqlfuzz.\s\sEnhance\s.selecttrace\soutput\sto\sshow\somitted\nORDER\sBY\sclauses.\s\sNew\sdbsqlfuzz\stest\scases\sadded.
D 2021-03-03T14:07:52.842
C Fix\sa\scase\swhere\sfts3\swas\serroneously\sreporting\scorruption.
D 2021-03-03T16:00:26.353
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -102,7 +102,7 @@ F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3
F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004
F ext/fts3/fts3_unicode.c 4b9af6151c29b35ed09574937083cece7c31e911f69615e168a39677569b684d
F ext/fts3/fts3_unicode2.c 416eb7e1e81142703520d284b768ca2751d40e31fa912cae24ba74860532bf0f
F ext/fts3/fts3_write.c 3b5df74d6563df46f90103a84630613a9fdb782ed93161470df2186e8e906d8c
F ext/fts3/fts3_write.c a5159accfd88f85fd3fc2298286d7a9427a02d1ea9a52b7c79730cff7a0bc03f
F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9
F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100
F ext/fts3/tool/fts3cov.sh c331d006359456cf6f8f953e37f2b9c7d568f3863f00bb5f7eb87fea4ac01b73
@ -1908,7 +1908,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 d2630ffafa077b8cfd75110b6b73da30f780edc920d2788769a4dc747f09d3f6
R 6fc5bf1132cdf5c151148fe503404c74
U drh
Z a92fbd9560cb903dfca1138c12b65d20
P 27a0388ad616f80e8dcc986c247a5c23a8565dae9081b04ff85bac0d357e531b
R e5c0eb34647a6c0313ec053d90365f5c
U dan
Z fd9193ef1dccf35779afbe7b97c23e4c

View File

@ -1 +1 @@
27a0388ad616f80e8dcc986c247a5c23a8565dae9081b04ff85bac0d357e531b
e6c7683c7503ac743d1d476c60c31f887b7ad829e26e812c25acdd4366044db8