SQLite

Check-in [54cc119811]
Login

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

Overview
Comment:Fix a 8-byte alignment problem that causes a SIGBUS on Sparc.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | branch-3.7.9
Files: files | file ages | folders
SHA1: 54cc11981127b52145e39f551d958580b1d45169
User & Date: drh 2011-11-14 02:53:54.950
Context
2012-10-05
18:38
Fix an accidental fork on branch-3.7.9. (check-in: cd9efeb3eb user: drh tags: branch-3.7.9)
2011-11-14
03:00
Forward port the 8-byte alignment fix from branch-3.7.9. (check-in: ebf6eb6ed7 user: drh tags: trunk)
02:53
Fix a 8-byte alignment problem that causes a SIGBUS on Sparc. (check-in: 54cc119811 user: drh tags: branch-3.7.9)
2011-11-01
00:52
Version 3.7.9 (check-in: c7c6050ef0 user: drh tags: trunk, release, version-3.7.9)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/build.c.
2657
2658
2659
2660
2661
2662
2663
2664
2665


2666
2667
2668
2669
2670





2671
2672
2673
2674
2675
2676




2677
2678
2679
2680
2681
2682
2683
2657
2658
2659
2660
2661
2662
2663


2664
2665





2666
2667
2668
2669
2670
2671
2672
2673
2674
2675

2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686







-
-
+
+
-
-
-
-
-
+
+
+
+
+





-
+
+
+
+








  /* 
  ** Allocate the index structure. 
  */
  nName = sqlite3Strlen30(zName);
  nCol = pList->nExpr;
  pIndex = sqlite3DbMallocZero(db, 
      sizeof(Index) +              /* Index structure  */
      sizeof(tRowcnt)*(nCol+1) +   /* Index.aiRowEst   */
      sizeof(Index) +                      /* Index structure  */
      ROUND8(sizeof(tRowcnt)*(nCol+1)) +   /* Index.aiRowEst   */
      sizeof(int)*nCol +           /* Index.aiColumn   */
      sizeof(char *)*nCol +        /* Index.azColl     */
      sizeof(u8)*nCol +            /* Index.aSortOrder */
      nName + 1 +                  /* Index.zName      */
      nExtra                       /* Collation sequence names */
      sizeof(char *)*nCol +                /* Index.azColl     */
      sizeof(int)*nCol +                   /* Index.aiColumn   */
      sizeof(u8)*nCol +                    /* Index.aSortOrder */
      nName + 1 +                          /* Index.zName      */
      nExtra                               /* Collation sequence names */
  );
  if( db->mallocFailed ){
    goto exit_create_index;
  }
  pIndex->aiRowEst = (tRowcnt*)(&pIndex[1]);
  pIndex->azColl = (char**)(&pIndex->aiRowEst[nCol+1]);
  pIndex->azColl = (char**)
     ((char*)pIndex->aiRowEst + ROUND8(sizeof(tRowcnt)*nCol+1));
  assert( EIGHT_BYTE_ALIGNMENT(pIndex->aiRowEst) );
  assert( EIGHT_BYTE_ALIGNMENT(pIndex->azColl) );
  pIndex->aiColumn = (int *)(&pIndex->azColl[nCol]);
  pIndex->aSortOrder = (u8 *)(&pIndex->aiColumn[nCol]);
  pIndex->zName = (char *)(&pIndex->aSortOrder[nCol]);
  zExtra = (char *)(&pIndex->zName[nName+1]);
  memcpy(pIndex->zName, zName, nName+1);
  pIndex->pTable = pTab;
  pIndex->nColumn = pList->nExpr;