Fossil

Check-in [c91e4871]
Login

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

Overview
Comment:Ensure that inputs to delta_create() are always memory aligned as if obtained from malloc().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:c91e48714012c62d33055bb0812bae6b8f99cad5
User & Date: drh 2016-10-05 12:59:37
Context
2016-10-05
23:06
Add another test for the unversioned command. check-in: d2a47575 user: mistachkin tags: trunk
12:59
Ensure that inputs to delta_create() are always memory aligned as if obtained from malloc(). check-in: c91e4871 user: drh tags: trunk
08:41
Update delta1 test cases to normalize the result so they pass again. Add additional tests to cover assertion failure caused by empty delta inputs. check-in: 4ede0df9 user: andybradford tags: trunk
06:54
Given that the buffer may not actually be memory obtained by malloc(), make sure that it is, that checksum() doesn't fail an assertion. Closed-Leaf check-in: 75ddc368 user: andybradford tags: pending-review
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/deltacmd.c.

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
*/
int blob_delta_create(Blob *pOriginal, Blob *pTarget, Blob *pDelta){
  const char *zOrig, *zTarg;
  int lenOrig, lenTarg;
  int len;
  char *zRes;
  blob_zero(pDelta);
  zOrig = blob_buffer(pOriginal);
  lenOrig = blob_size(pOriginal);
  zTarg = blob_buffer(pTarget);
  lenTarg = blob_size(pTarget);
  blob_resize(pDelta, lenTarg+16);
  zRes = blob_buffer(pDelta);
  len = delta_create(zOrig, lenOrig, zTarg, lenTarg, zRes);
  blob_resize(pDelta, len);
  return 0;
}

/*
** COMMAND: test-delta-create







|

|


|







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
*/
int blob_delta_create(Blob *pOriginal, Blob *pTarget, Blob *pDelta){
  const char *zOrig, *zTarg;
  int lenOrig, lenTarg;
  int len;
  char *zRes;
  blob_zero(pDelta);
  zOrig = blob_materialize(pOriginal);
  lenOrig = blob_size(pOriginal);
  zTarg = blob_materialize(pTarget);
  lenTarg = blob_size(pTarget);
  blob_resize(pDelta, lenTarg+16);
  zRes = blob_materialize(pDelta);
  len = delta_create(zOrig, lenOrig, zTarg, lenTarg, zRes);
  blob_resize(pDelta, len);
  return 0;
}

/*
** COMMAND: test-delta-create