SQLite

Check-in [8b7a7fcf62]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix an off-by-one error in the size computation of a vdbe-sorter. Forum post c1cc8b057a. Problem introduced by checkin [d4307a0d43f42e96].
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8b7a7fcf62e5c2742c243808fa482472954f2b4aae0bc7ae513bc07065c93737
User & Date: drh 2025-06-01 21:38:35.769
Context
2025-06-02
09:49
Fix stale comments related to KeyInfo. Add new assert()s associated with memory management of KeyInfo. (check-in: abd805bc76 user: drh tags: trunk)
2025-06-01
21:49
Fix an off-by-one error in the size computation of a vdbe-sorter. (check-in: d5ab065727 user: drh tags: branch-3.50)
21:38
Fix an off-by-one error in the size computation of a vdbe-sorter. Forum post c1cc8b057a. Problem introduced by checkin [d4307a0d43f42e96]. (check-in: 8b7a7fcf62 user: drh tags: trunk)
16:10
Fix VACUUM so that it works even when ATTACH_WRITE is disabled. (check-in: 42494f85ac user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/vdbesort.c.
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
#endif

  assert( pCsr->pKeyInfo );
  assert( !pCsr->isEphemeral );
  assert( pCsr->eCurType==CURTYPE_SORTER );
  assert( sizeof(KeyInfo) + UMXV(pCsr->pKeyInfo->nKeyField)*sizeof(CollSeq*)
               < 0x7fffffff );
  szKeyInfo = SZ_KEYINFO(pCsr->pKeyInfo->nKeyField+1);
  sz = SZ_VDBESORTER(nWorker+1);

  pSorter = (VdbeSorter*)sqlite3DbMallocZero(db, sz + szKeyInfo);
  pCsr->uc.pSorter = pSorter;
  if( pSorter==0 ){
    rc = SQLITE_NOMEM_BKPT;
  }else{







|







965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
#endif

  assert( pCsr->pKeyInfo );
  assert( !pCsr->isEphemeral );
  assert( pCsr->eCurType==CURTYPE_SORTER );
  assert( sizeof(KeyInfo) + UMXV(pCsr->pKeyInfo->nKeyField)*sizeof(CollSeq*)
               < 0x7fffffff );
  szKeyInfo = SZ_KEYINFO(pCsr->pKeyInfo->nKeyField);
  sz = SZ_VDBESORTER(nWorker+1);

  pSorter = (VdbeSorter*)sqlite3DbMallocZero(db, sz + szKeyInfo);
  pCsr->uc.pSorter = pSorter;
  if( pSorter==0 ){
    rc = SQLITE_NOMEM_BKPT;
  }else{