mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Fix an assert so that it compares two CellInfo objects field by field
instead of using memcmp(). Memcmp() does not work on x86 because of uninitialized padding bytes. FossilOrigin-Name: 88258770adead70fa101c74e266a37bb9aaffac0ba738a4b345617feb8c46477
This commit is contained in:
10
src/btree.c
10
src/btree.c
@@ -4388,11 +4388,19 @@ int sqlite3BtreeCloseCursor(BtCursor *pCur){
|
||||
** Using this cache reduces the number of calls to btreeParseCell().
|
||||
*/
|
||||
#ifndef NDEBUG
|
||||
static int cellInfoEqual(CellInfo *a, CellInfo *b){
|
||||
if( a->nKey!=b->nKey ) return 0;
|
||||
if( a->pPayload!=b->pPayload ) return 0;
|
||||
if( a->nPayload!=b->nPayload ) return 0;
|
||||
if( a->nLocal!=b->nLocal ) return 0;
|
||||
if( a->nSize!=b->nSize ) return 0;
|
||||
return 1;
|
||||
}
|
||||
static void assertCellInfo(BtCursor *pCur){
|
||||
CellInfo info;
|
||||
memset(&info, 0, sizeof(info));
|
||||
btreeParseCell(pCur->pPage, pCur->ix, &info);
|
||||
assert( CORRUPT_DB || memcmp(&info, &pCur->info, sizeof(info))==0 );
|
||||
assert( CORRUPT_DB || cellInfoEqual(&info, &pCur->info) );
|
||||
}
|
||||
#else
|
||||
#define assertCellInfo(x)
|
||||
|
Reference in New Issue
Block a user