Fossil

Check-in [265f8e2d]
Login

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

Overview
Comment:Change the database fingerprint algorithm slightly so that it is not dependent on the details of floating-point computations, and thus gives the same answer on a native x64 processor as it does under valgrind. Also fix a bug in the RID change event computation so that it works even if files have been added.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 265f8e2d8337f4c34e3dfc7645f2c81c65f0f3fb33f1d195fa09f387d4d20dfc
User & Date: drh 2019-09-23 18:25:23
Context
2019-09-23
19:35
Fix an off-by-one error in the BOM decoder. check-in: b3f45b33 user: drh tags: trunk
19:07
Add support for testing with libFuzzer. Leaf check-in: 8a6e8e27 user: drh tags: libFuzzer
18:25
Change the database fingerprint algorithm slightly so that it is not dependent on the details of floating-point computations, and thus gives the same answer on a native x64 processor as it does under valgrind. Also fix a bug in the RID change event computation so that it works even if files have been added. check-in: 265f8e2d user: drh tags: trunk
2019-09-21
17:50
Update the built-in SQLite to the latest 3.30.0 alpha version, for testing. check-in: 44900415 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/db.c.

3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
**
** The fingerprint consists of the rcvid, a "/", and the MD5 checksum of
** the remaining fields of the RCVFROM table entry.  MD5 is used for this
** because it is 4x faster than SHA3 and 5x faster than SHA1, and there
** are no security concerns - this is just a checksum, not a security
** token.
*/
char *db_fingerprint(int rcvid){
  char *z = 0;
  Blob sql = BLOB_INITIALIZER;
  Stmt q;
  blob_append_sql(&sql,
    "SELECT rcvid, quote(uid), quote(mtime), quote(nonce), quote(ipaddr)"
    "  FROM rcvfrom"
  );
  if( rcvid<=0 ){
    blob_append_sql(&sql, " ORDER BY rcvid DESC LIMIT 1");
  }else{
    blob_append_sql(&sql, " WHERE rcvid=%d", rcvid);
  }







|




|







3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
**
** The fingerprint consists of the rcvid, a "/", and the MD5 checksum of
** the remaining fields of the RCVFROM table entry.  MD5 is used for this
** because it is 4x faster than SHA3 and 5x faster than SHA1, and there
** are no security concerns - this is just a checksum, not a security
** token.
*/
char *db_fingerprint(int rcvid){ 
  char *z = 0;
  Blob sql = BLOB_INITIALIZER;
  Stmt q;
  blob_append_sql(&sql,
    "SELECT rcvid, quote(uid), datetime(mtime), quote(nonce), quote(ipaddr)"
    "  FROM rcvfrom"
  );
  if( rcvid<=0 ){
    blob_append_sql(&sql, " ORDER BY rcvid DESC LIMIT 1");
  }else{
    blob_append_sql(&sql, " WHERE rcvid=%d", rcvid);
  }

Changes to src/vfile.c.

1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
     "WITH allrid(x) AS ("
     "  SELECT rid FROM vfile"
     "  UNION SELECT mrid FROM vfile"
     "  UNION SELECT merge FROM vmerge"
     "  UNION SELECT %d"
     ")"
     "SELECT group_concat(x,' ') FROM allrid"
     " WHERE x NOT IN (SELECT oldrid FROM idMap);",
     oldVid
  );
  if( zUnresolved[0] ){
    fossil_fatal("Unresolved RID values: %s\n", zUnresolved);
  }

  /* Make the changes to the VFILE and VMERGE tables */







|







1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
     "WITH allrid(x) AS ("
     "  SELECT rid FROM vfile"
     "  UNION SELECT mrid FROM vfile"
     "  UNION SELECT merge FROM vmerge"
     "  UNION SELECT %d"
     ")"
     "SELECT group_concat(x,' ') FROM allrid"
     " WHERE x<>0 AND x NOT IN (SELECT oldrid FROM idMap);",
     oldVid
  );
  if( zUnresolved[0] ){
    fossil_fatal("Unresolved RID values: %s\n", zUnresolved);
  }

  /* Make the changes to the VFILE and VMERGE tables */