Fix a subtle bug in the remember UDF of the kvtest.exe utility program.

FossilOrigin-Name: 9eea3670e77e2f831b7c00ae2d65a5583f9cad626d9ab286f92582ef29ecd4e3
This commit is contained in:
drh 2017-06-05 19:20:35 +00:00
parent b1d66c5986
commit cf1393df94
3 changed files with 18 additions and 18 deletions

View File

@ -1,5 +1,5 @@
C Fix\sa\sbug\sin\stest_fs.c\sthat\soccurs\swhen\sthe\sfirst\scomponent\sof\sa\spath\scontains\na\sGLOB\sor\sLIKE\sescape\scharacter. C Fix\sa\ssubtle\sbug\sin\sthe\sremember\sUDF\sof\sthe\skvtest.exe\sutility\sprogram.
D 2017-06-05T16:33:53.195 D 2017-06-05T19:20:35.377
F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 8eeb80162074004e906b53d7340a12a14c471a83743aab975947e95ce061efcc F Makefile.msc 8eeb80162074004e906b53d7340a12a14c471a83743aab975947e95ce061efcc
@ -925,7 +925,7 @@ F test/json102.test eeb54efa221e50b74a2d6fb9259963b48d7414dca3ce2fdfdeed45cb2848
F test/json103.test c5f6b85e69de05f6b3195f9f9d5ce9cd179099a0 F test/json103.test c5f6b85e69de05f6b3195f9f9d5ce9cd179099a0
F test/json104.test 877d5845f6303899b7889ea5dd1bea99076e3100574d5c536082245c5805dcaa F test/json104.test 877d5845f6303899b7889ea5dd1bea99076e3100574d5c536082245c5805dcaa
F test/keyword1.test 37ef6bba5d2ed5b07ecdd6810571de2956599dff F test/keyword1.test 37ef6bba5d2ed5b07ecdd6810571de2956599dff
F test/kvtest.c 4e274696ee1cc588be38ce2d50015b564a79c076084126839a4599bf705fbd15 F test/kvtest.c d2b8cfc91047ebf6cac4f3a04f19c3a864e4ecfd683bbb65c395df450b8dc79c
F test/lastinsert.test 42e948fd6442f07d60acbd15d33fb86473e0ef63 F test/lastinsert.test 42e948fd6442f07d60acbd15d33fb86473e0ef63
F test/laststmtchanges.test ae613f53819206b3222771828d024154d51db200 F test/laststmtchanges.test ae613f53819206b3222771828d024154d51db200
F test/like.test 0603f4fa0dad50987f70032c05800cbfa8985302 F test/like.test 0603f4fa0dad50987f70032c05800cbfa8985302
@ -1582,7 +1582,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P f3c25df4562efda2adeb211a4cc893246354917849a0fa4d95da3d7970e9588e P 73c70590d7689806901378cd2a7e167ec4339f886031369266e07868acd23b93
R aa24b19a4f45442ffc34eeb6356fadd9 R 0c827ca5686a71389301c8ab16d1380c
U dan U drh
Z 26a8d8f95b610c30297dc9723021b8e7 Z aa16b10f95a81423ef1d2e52e40fab88

View File

@ -1 +1 @@
73c70590d7689806901378cd2a7e167ec4339f886031369266e07868acd23b93 9eea3670e77e2f831b7c00ae2d65a5583f9cad626d9ab286f92582ef29ecd4e3

View File

@ -543,7 +543,7 @@ static int exportMain(int argc, char **argv){
zTail = zFN + nFN + 1; zTail = zFN + nFN + 1;
while( sqlite3_step(pStmt)==SQLITE_ROW ){ while( sqlite3_step(pStmt)==SQLITE_ROW ){
int iKey = sqlite3_column_int(pStmt, 0); int iKey = sqlite3_column_int(pStmt, 0);
int nData = sqlite3_column_bytes(pStmt, 1); sqlite3_int64 nData = sqlite3_column_bytes(pStmt, 1);
const void *pData = sqlite3_column_blob(pStmt, 1); const void *pData = sqlite3_column_blob(pStmt, 1);
FILE *out; FILE *out;
if( ePathType==PATH_DIR ){ if( ePathType==PATH_DIR ){
@ -587,7 +587,7 @@ static int exportMain(int argc, char **argv){
** NULL is returned if any error is encountered. The final value of *pnByte ** NULL is returned if any error is encountered. The final value of *pnByte
** is undefined in this case. ** is undefined in this case.
*/ */
static unsigned char *readFile(const char *zName, int *pnByte){ static unsigned char *readFile(const char *zName, sqlite3_int64 *pnByte){
FILE *in; /* FILE from which to read content of zName */ FILE *in; /* FILE from which to read content of zName */
sqlite3_int64 nIn; /* Size of zName in bytes */ sqlite3_int64 nIn; /* Size of zName in bytes */
size_t nRead; /* Number of bytes actually read */ size_t nRead; /* Number of bytes actually read */
@ -605,7 +605,7 @@ static unsigned char *readFile(const char *zName, int *pnByte){
sqlite3_free(pBuf); sqlite3_free(pBuf);
return 0; return 0;
} }
if( pnByte ) *pnByte = (int)nIn; if( pnByte ) *pnByte = nIn;
return pBuf; return pBuf;
} }
@ -613,7 +613,7 @@ static unsigned char *readFile(const char *zName, int *pnByte){
** Overwrite a file with randomness. Do not change the size of the ** Overwrite a file with randomness. Do not change the size of the
** file. ** file.
*/ */
static void updateFile(const char *zName, int *pnByte, int doFsync){ static void updateFile(const char *zName, sqlite3_int64 *pnByte, int doFsync){
FILE *out; /* FILE from which to read content of zName */ FILE *out; /* FILE from which to read content of zName */
sqlite3_int64 sz; /* Size of zName in bytes */ sqlite3_int64 sz; /* Size of zName in bytes */
size_t nWritten; /* Number of bytes actually read */ size_t nWritten; /* Number of bytes actually read */
@ -624,7 +624,7 @@ static void updateFile(const char *zName, int *pnByte, int doFsync){
if( sz<0 ){ if( sz<0 ){
fatalError("No such file: \"%s\"", zName); fatalError("No such file: \"%s\"", zName);
} }
*pnByte = (int)sz; *pnByte = sz;
if( sz==0 ) return; if( sz==0 ) return;
pBuf = sqlite3_malloc64( sz ); pBuf = sqlite3_malloc64( sz );
if( pBuf==0 ){ if( pBuf==0 ){
@ -820,10 +820,10 @@ static int runMain(int argc, char **argv){
sqlite3_int64 tmStart; /* Start time */ sqlite3_int64 tmStart; /* Start time */
sqlite3_int64 tmElapsed; /* Elapsed time */ sqlite3_int64 tmElapsed; /* Elapsed time */
int mmapSize = 0; /* --mmap N argument */ int mmapSize = 0; /* --mmap N argument */
int nData = 0; /* Bytes of data */ sqlite3_int64 nData = 0; /* Bytes of data */
sqlite3_int64 nTotal = 0; /* Total data read */ sqlite3_int64 nTotal = 0; /* Total data read */
unsigned char *pData = 0; /* Content of the blob */ unsigned char *pData = 0; /* Content of the blob */
int nAlloc = 0; /* Space allocated for pData[] */ sqlite3_int64 nAlloc = 0; /* Space allocated for pData[] */
const char *zJMode = 0; /* Journal mode */ const char *zJMode = 0; /* Journal mode */
@ -1013,18 +1013,18 @@ static int runMain(int argc, char **argv){
nData = sqlite3_blob_bytes(pBlob); nData = sqlite3_blob_bytes(pBlob);
if( nAlloc<nData+1 ){ if( nAlloc<nData+1 ){
nAlloc = nData+100; nAlloc = nData+100;
pData = sqlite3_realloc(pData, nAlloc); pData = sqlite3_realloc64(pData, nAlloc);
} }
if( pData==0 ) fatalError("cannot allocate %d bytes", nData+1); if( pData==0 ) fatalError("cannot allocate %d bytes", nData+1);
if( isUpdateTest ){ if( isUpdateTest ){
sqlite3_randomness((int)nData, pData); sqlite3_randomness((int)nData, pData);
rc = sqlite3_blob_write(pBlob, pData, nData, 0); rc = sqlite3_blob_write(pBlob, pData, (int)nData, 0);
if( rc!=SQLITE_OK ){ if( rc!=SQLITE_OK ){
fatalError("could not write the blob at %d: %s", iKey, fatalError("could not write the blob at %d: %s", iKey,
sqlite3_errmsg(db)); sqlite3_errmsg(db));
} }
}else{ }else{
rc = sqlite3_blob_read(pBlob, pData, nData, 0); rc = sqlite3_blob_read(pBlob, pData, (int)nData, 0);
if( rc!=SQLITE_OK ){ if( rc!=SQLITE_OK ){
fatalError("could not read the blob at %d: %s", iKey, fatalError("could not read the blob at %d: %s", iKey,
sqlite3_errmsg(db)); sqlite3_errmsg(db));