SQLite

Check-in [0b06ce6d8e]
Login

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

Overview
Comment:Fix minor problems with passing NULL pointers to memcmp() and memcpy() found by -fsanitize=undefined.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0b06ce6d8e7cff5cd5d467a94522dfef5593d7c26663ce03c2c2b663a2641551
User & Date: dan 2018-03-23 16:31:34.359
Context
2018-03-23
17:36
Fix typos in sqlite3session.h preventing documentation webpages from being generated. Also mark all new sessions functions (those related to rebasing) as experimental. (check-in: de974235a8 user: dan tags: trunk)
16:31
Fix minor problems with passing NULL pointers to memcmp() and memcpy() found by -fsanitize=undefined. (check-in: 0b06ce6d8e user: dan tags: trunk)
16:08
Fix the -readonly option on the CLI so that it actually works. (check-in: 0477fb3fd6 user: drh tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to ext/misc/zipfile.c.
2057
2058
2059
2060
2061
2062
2063

2064
2065
2066




2067
2068
2069
2070
2071
2072
2073
2057
2058
2059
2060
2061
2062
2063
2064



2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075







+
-
-
-
+
+
+
+








  /* Append the LFH to the body of the new archive */
  nByte = ZIPFILE_LFH_FIXED_SZ + e.cds.nFile + 9;
  if( (rc = zipfileBufferGrow(&p->body, nByte)) ) goto zipfile_step_out;
  p->body.n += zipfileSerializeLFH(&e, &p->body.a[p->body.n]);

  /* Append the data to the body of the new archive */
  if( nData>0 ){
  if( (rc = zipfileBufferGrow(&p->body, nData)) ) goto zipfile_step_out;
  memcpy(&p->body.a[p->body.n], aData, nData);
  p->body.n += nData;
    if( (rc = zipfileBufferGrow(&p->body, nData)) ) goto zipfile_step_out;
    memcpy(&p->body.a[p->body.n], aData, nData);
    p->body.n += nData;
  }

  /* Append the CDS record to the directory of the new archive */
  nByte = ZIPFILE_CDS_FIXED_SZ + e.cds.nFile + 9;
  if( (rc = zipfileBufferGrow(&p->cds, nByte)) ) goto zipfile_step_out;
  p->cds.n += zipfileSerializeCDS(&e, &p->cds.a[p->cds.n]);

  /* Increment the count of entries in the archive */
Changes to ext/session/sqlite3session.c.
835
836
837
838
839
840
841
842

843
844
845
846
847
848
849
835
836
837
838
839
840
841

842
843
844
845
846
847
848
849







-
+







        a += sessionVarintGet(a, &n);
        if( sqlite3_value_bytes(pVal)!=n ) return 0;
        if( eType==SQLITE_TEXT ){
          z = sqlite3_value_text(pVal);
        }else{
          z = sqlite3_value_blob(pVal);
        }
        if( memcmp(a, z, n) ) return 0;
        if( n>0 && memcmp(a, z, n) ) return 0;
        a += n;
      }
    }
  }

  return 1;
}