From: drh <> Date: Thu, 27 Nov 2025 11:29:14 +0000 (+0000) Subject: Ensure that the split-column transformer in QRF correctly X-Git-Tag: artiphishell~163 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00bca0b6de8584b8e6e41dc428111f6a8a69c78e;p=thirdparty%2Fsqlite.git Ensure that the split-column transformer in QRF correctly transforms the abNum[] array. FossilOrigin-Name: ea67d8b001d1be3b0410ca697ff7ddda71c957c8ecb6d76e75133ba39b754623 --- diff --git a/ext/qrf/qrf.c b/ext/qrf/qrf.c index d7a6336b4a..846f7652c5 100644 --- a/ext/qrf/qrf.c +++ b/ext/qrf/qrf.c @@ -1544,6 +1544,7 @@ static void qrfSplitColumn(qrfColData *pData, Qrf *p){ int *aw = 0; char **az = 0; int *aiWth = 0; + unsigned char *abNum = 0; int nColNext = 2; int w; struct qrfPerCol *a = 0; @@ -1582,9 +1583,18 @@ static void qrfSplitColumn(qrfColData *pData, Qrf *p){ qrfOom(p); return; } + abNum = sqlite3_malloc64( nRow*nCol ); + if( abNum==0 ){ + sqlite3_free(az); + sqlite3_free(aiWth); + sqlite3_free(a); + qrfOom(p); + return; + } for(i=0; in; i++){ sqlite3_int64 j = (i%nRow)*nCol + (i/nRow); az[j] = pData->az[i]; + abNum[j]= pData->abNum[i]; pData->az[i] = 0; aiWth[j] = pData->aiWth[i]; } @@ -1593,6 +1603,7 @@ static void qrfSplitColumn(qrfColData *pData, Qrf *p){ az[j] = sqlite3_mprintf(""); if( az[j]==0 ) qrfOom(p); aiWth[j] = 0; + abNum[j] = 0; i++; } for(i=0; iaz); sqlite3_free(pData->aiWth); sqlite3_free(pData->a); + sqlite3_free(pData->abNum); sqlite3_free(aw); pData->az = az; pData->aiWth = aiWth; pData->a = a; + pData->abNum = abNum; pData->nCol = nCol; pData->n = pData->nAlloc = nRow*nCol; for(i=w=0; i