mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
Make use of the flexible-array feature of C99, when available, to try to
pacify -fsanitize=strict-bounds. This check-in fixes the core. There is more yet to do in FTS3, RTREE, and in FTS5. FossilOrigin-Name: 6fd6b32d06bd6a705e5140cd613af823b8183a6f6a9ceeeedfcf5e8b50821d68
This commit is contained in:
@@ -597,9 +597,13 @@ struct WalIterator {
|
||||
u32 *aPgno; /* Array of page numbers. */
|
||||
int nEntry; /* Nr. of entries in aPgno[] and aIndex[] */
|
||||
int iZero; /* Frame number associated with aPgno[0] */
|
||||
} aSegment[1]; /* One for every 32KB page in the wal-index */
|
||||
} aSegment[FLEXARRAY]; /* One for every 32KB page in the wal-index */
|
||||
};
|
||||
|
||||
/* Size (in bytes) of a WalIterator object suitable for N or fewer segments */
|
||||
#define SZ_WALITERATOR(N) \
|
||||
(offsetof(WalIterator,aSegment)*(N)*sizeof(struct WalSegment))
|
||||
|
||||
/*
|
||||
** Define the parameters of the hash tables in the wal-index file. There
|
||||
** is a hash-table following every HASHTABLE_NPAGE page numbers in the
|
||||
@@ -1960,8 +1964,7 @@ static int walIteratorInit(Wal *pWal, u32 nBackfill, WalIterator **pp){
|
||||
|
||||
/* Allocate space for the WalIterator object. */
|
||||
nSegment = walFramePage(iLast) + 1;
|
||||
nByte = sizeof(WalIterator)
|
||||
+ (nSegment-1)*sizeof(struct WalSegment)
|
||||
nByte = SZ_WALITERATOR(nSegment)
|
||||
+ iLast*sizeof(ht_slot);
|
||||
p = (WalIterator *)sqlite3_malloc64(nByte
|
||||
+ sizeof(ht_slot) * (iLast>HASHTABLE_NPAGE?HASHTABLE_NPAGE:iLast)
|
||||
|
Reference in New Issue
Block a user