/ Check-in [9ec92939]
Login

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

Overview
Comment:Improvement to the hexdb interpreter built into the CLI and into the TCL test harness: Round the "size" up to the next multiple of the "pagesize".
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9ec92939cb2d2c96ae15bc496feed233ce31424c25a6bf86ace7e0ef3eedec5b
User & Date: drh 2019-07-17 15:05:16
Context
2019-07-17
16:18
Fix an incorrect assert() in balance_nonroot(). check-in: 59c9e73f user: drh tags: trunk
15:05
Improvement to the hexdb interpreter built into the CLI and into the TCL test harness: Round the "size" up to the next multiple of the "pagesize". check-in: 9ec92939 user: drh tags: trunk
14:34
When processing a BETWEEN or CASE expression, avoid transforming a node of the original expression into a TK_REGISTER node. Instead, take a copy and use it instead. Fix for [1be72aab9]. check-in: 7ef7b23c user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to src/shell.c.in.

  3887   3887     }
  3888   3888     *pnData = 0;
  3889   3889     nLine++;
  3890   3890     if( fgets(zLine, sizeof(zLine), in)==0 ) goto readHexDb_error;
  3891   3891     rc = sscanf(zLine, "| size %d pagesize %d", &n, &pgsz);
  3892   3892     if( rc!=2 ) goto readHexDb_error;
  3893   3893     if( n<0 ) goto readHexDb_error;
         3894  +  if( pgsz<512 || pgsz>65536 || (pgsz&(pgsz-1))!=0 ) goto readHexDb_error;
         3895  +  n = (n+pgsz-1)&~(pgsz-1);  /* Round n up to the next multiple of pgsz */
  3894   3896     a = sqlite3_malloc( n ? n : 1 );
  3895   3897     if( a==0 ){
  3896   3898       utf8_printf(stderr, "Out of memory!\n");
  3897   3899       goto readHexDb_error;
  3898   3900     }
  3899   3901     memset(a, 0, n);
  3900   3902     if( pgsz<512 || pgsz>65536 || (pgsz & (pgsz-1))!=0 ){

Changes to src/test1.c.

  7736   7736       for(iNext=i; zIn[iNext] && zIn[iNext]!='\n'; iNext++){}
  7737   7737       if( zIn[iNext]=='\n' ) iNext++;
  7738   7738       while( zIn[i]==' ' || zIn[i]=='\t' ){ i++; }
  7739   7739       if( a==0 ){
  7740   7740         int pgsz;
  7741   7741         rc = sscanf(zIn+i, "| size %d pagesize %d", &n, &pgsz);
  7742   7742         if( rc!=2 ) continue;
         7743  +      if( pgsz<512 || pgsz>65536 || (pgsz&(pgsz-1))!=0 ){
         7744  +        Tcl_AppendResult(interp, "bad 'pagesize' field", (void*)0);
         7745  +        return TCL_ERROR;
         7746  +      }
         7747  +      n = (n+pgsz-1)&~(pgsz-1);  /* Round n up to the next multiple of pgsz */
  7743   7748         if( n<512 ){
  7744   7749           Tcl_AppendResult(interp, "bad 'size' field", (void*)0);
  7745   7750           return TCL_ERROR;
  7746   7751         }
  7747   7752         a = malloc( n );
  7748   7753         if( a==0 ){
  7749   7754           Tcl_AppendResult(interp, "out of memory", (void*)0);