1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Use flexible arrays in the recovery extension and in the fuzzcheck test program.

Adjust the unix makefile to use -fsanitize=bounds-strict when building
fuzzcheck-asan.

FossilOrigin-Name: 6ea6a6b211fed1a14d7bec1ab1790dec09e2a00423860498a60b760c4a4561fa
This commit is contained in:
drh
2025-03-15 13:04:16 +00:00
parent bd0e3ed522
commit 0a4f10e6e2
5 changed files with 26 additions and 18 deletions

View File

@ -140,9 +140,12 @@ struct RecoverColumn {
typedef struct RecoverBitmap RecoverBitmap;
struct RecoverBitmap {
i64 nPg; /* Size of bitmap */
u32 aElem[1]; /* Array of 32-bit bitmasks */
u32 aElem[]; /* Array of 32-bit bitmasks */
};
/* Size in bytes of a RecoverBitmap object sufficient to cover 32 pages */
#define SZ_RECOVERBITMAP_32 (16)
/*
** State variables (part of the sqlite3_recover structure) used while
** recovering data for tables identified in the recovered schema (state
@ -382,7 +385,7 @@ static int recoverError(
*/
static RecoverBitmap *recoverBitmapAlloc(sqlite3_recover *p, i64 nPg){
int nElem = (nPg+1+31) / 32;
int nByte = sizeof(RecoverBitmap) + nElem*sizeof(u32);
int nByte = SZ_RECOVERBITMAP_32 + nElem*sizeof(u32);
RecoverBitmap *pRet = (RecoverBitmap*)recoverMalloc(p, nByte);
if( pRet ){