-C Improved\scomment\son\sthe\ssharedB.test\stest\sscript.
-D 2014-12-05T14:34:30.550
+C Add\scode\sto\scheck\sthe\svalidity\sof\sCollSeq\sobjects\sduring\sruntime.\s\sThis\scode\nwas\snot\sable\sto\sdetect\sanomalies\ssuch\sas\scame\sup\sas\sa\sresult\sof\nticket\s[e4a18565a36884b00edf66541f38c693827968ab]\sso\sit\sis\sput\sinto\sa\sbranch\nfor\shistorical\sreference,\swith\sthe\sintent\sof\sleaving\sit\sout\sof\strunk.
+D 2014-12-05T14:36:15.903
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F src/btree.h e31a3a3ebdedb1caf9bda3ad5dbab3db9b780f6e
F src/btreeInt.h 3363e18fd76f69a27a870b25221b2345b3fd4d21
F src/build.c 67bb05b1077e0cdaccb2e36bfcbe7a5df9ed31e8
-F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0
+F src/callback.c 759c9aff944f72fd7fb810594d95af1092a8433a
F src/complete.c c4ba6e0626bb94bc77a0861735f3382fcf7cc818
F src/ctime.c df19848891c8a553c80e6f5a035e768280952d1a
F src/date.c 93594514aae68de117ca4a2a0d6cc63eddf26744
F src/sqlite.h.in 6ec654324cb490ea3d8a7be28b8c7d37fe4ad282
F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d
-F src/sqliteInt.h 28049b803b74a7f73242a8226915ea00ebb1309f
+F src/sqliteInt.h ef42a0515a846ab2a670bda705be494d7acc2535
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
F src/status.c 81712116e826b0089bb221b018929536b2b5406f
F src/table.c f142bba7903e93ca8d113a5b8877a108ad1a27dc
F src/vdbe.h 6fc69d9c5e146302c56e163cb4b31d1ee64a18c3
F src/vdbeInt.h 9bb69ff2447c34b6ccc58b34ec35b615f86ead78
F src/vdbeapi.c 07acb615d1e4170e71fc1b0d087f3c53a1ad8e83
-F src/vdbeaux.c 6f7f39c3fcf0f5923758df8561bb5d843908a553
+F src/vdbeaux.c 7e0a097ac7cf716300128f18147ef9af7c9d1130
F src/vdbeblob.c 4af4bfb71f6df7778397b4a0ebc1879793276778
F src/vdbemem.c 31d8eabb0cd78bfeab4e5124c7363c3e9e54db9f
F src/vdbesort.c 42c166f7ca78cb643c7f4e4bdfa83c59d363d1a6
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P ffea3e905adc108d2dc37f5d6da2024f0389f176
-R 2f7d3cb7a2e1e65c7403b8d51d471007
+P 71f589e3f82a07513425e212072f32748c0732d4
+R 02b8ea23886487ef9860b5ee40d238ab
+T *branch * collseq-checking
+T *sym-collseq-checking *
+T -sym-fix-stale-keyinfo-cache *
U drh
-Z 951231dae63f2db1845bdae375b332da
+Z 74adfe1c6f95aa3cd0aa6e2d3a771e07
-71f589e3f82a07513425e212072f32748c0732d4
\ No newline at end of file
+68b23c3d41ce9303f42251d0c199181312e148f9
\ No newline at end of file
if( p && !p->xCmp && synthCollSeq(db, p) ){
p = 0;
}
- assert( !p || p->xCmp );
+ assert( p==0 || (sqlite3ValidCollSeq(p) && p->xCmp!=0) );
if( p==0 ){
sqlite3ErrorMsg(pParse, "no such collation sequence: %s", zName);
}
return pColl;
}
+#ifdef SQLITE_DEBUG
+/*
+** The following routine does sanity checking on a CollSeq object and
+** returns 1 if everything looks ok and 0 if the CollSeq object appears
+** to be corrupt. This routine is used only inside of assert() statements.
+*/
+int sqlite3ValidCollSeq(const CollSeq *p){
+ /* The CollSeq must be one of a triple and the zName field must
+ ** point to the first byte after that triple
+ */
+ int n = (int)(p->zName - (char*)p)/sizeof(CollSeq);
+ if( n<=0 || n>3 ) return 0;
+
+ /* Check for valid enc values */
+ if( p->enc==SQLITE_UTF8 ) return 1;
+ if( p->enc==SQLITE_UTF16LE ) return 1;
+ if( p->enc==SQLITE_UTF16BE ) return 1;
+ if( p->enc==(SQLITE_UTF16LE|SQLITE_UTF16_ALIGNED) ) return 1;
+ if( p->enc==(SQLITE_UTF16BE|SQLITE_UTF16_ALIGNED) ) return 1;
+
+ /* Otherwise, malformed */
+ return 0;
+}
+#endif /* SQLITE_DEBUG */
+
/*
** Parameter zName points to a UTF-8 encoded string nName bytes long.
** Return the CollSeq* pointer for the collation sequence named zName
}
assert( SQLITE_UTF8==1 && SQLITE_UTF16LE==2 && SQLITE_UTF16BE==3 );
assert( enc>=SQLITE_UTF8 && enc<=SQLITE_UTF16BE );
- if( pColl ) pColl += enc-1;
+ if( pColl ){
+ pColl += enc-1;
+ assert( sqlite3ValidCollSeq(pColl) );
+ }
return pColl;
}
const char *sqlite3ErrStr(int);
int sqlite3ReadSchema(Parse *pParse);
+#if defined(SQLITE_DEBUG)
+int sqlite3ValidCollSeq(const CollSeq*);
+#endif
CollSeq *sqlite3FindCollSeq(sqlite3*,u8 enc, const char*,int);
CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char*zName);
CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr);
CollSeq *pColl = pKeyInfo->aColl[j];
const char *zColl = pColl ? pColl->zName : "nil";
int n = sqlite3Strlen30(zColl);
+ assert( pColl==0 || sqlite3ValidCollSeq(pColl) );
if( n==6 && memcmp(zColl,"BINARY",6)==0 ){
zColl = "B";
n = 1;
const CollSeq *pColl,
u8 *prcErr /* If an OOM occurs, set to SQLITE_NOMEM */
){
+ assert( sqlite3ValidCollSeq(pColl) );
if( pMem1->enc==pColl->enc ){
/* The strings are already in the correct encoding. Call the
** comparison function directly */
assert( !pColl || pColl->xCmp );
if( pColl ){
+ assert( sqlite3ValidCollSeq(pColl) );
return vdbeCompareMemString(pMem1, pMem2, pColl, 0);
}
/* If a NULL pointer was passed as the collate function, fall through