Merge the latest trunk changes and the fix for the crash on a corrupt

database.

FossilOrigin-Name: 0b35346c32dba14963c85ec178f2b46aa2bbf6dc
This commit is contained in:
drh
2014-03-27 00:09:00 +00:00
5 changed files with 51 additions and 19 deletions
+5
View File
@@ -3434,6 +3434,7 @@ int sqlite3VdbeRecordCompare(
}else{
idx1 = getVarint32(aKey1, szHdr1);
d1 = szHdr1;
if( d1>(unsigned)nKey1 ) return 1; /* Corruption */
i = 0;
}
@@ -3589,6 +3590,9 @@ int sqlite3VdbeRecordCompare(
** that (a) the first field of pPKey2 is an integer, and (b) the
** size-of-header varint at the start of (pKey1/nKey1) fits in a single
** byte (i.e. is less than 128).
**
** To avoid concerns about buffer overreads, this routine is only used
** on schemas where the maximum valid header size is 63 bytes or less.
*/
static int vdbeRecordCompareInt(
int nKey1, const void *pKey1, /* Left key */
@@ -3605,6 +3609,7 @@ static int vdbeRecordCompareInt(
UNUSED_PARAMETER(bSkip);
assert( bSkip==0 );
assert( (*(u8*)pKey1)<=0x3F || CORRUPT_DB );
switch( serial_type ){
case 1: { /* 1-byte signed integer */
lhs = ONE_BYTE_INT(aKey);