aboutsummaryrefslogtreecommitdiff
path: root/patch_read_write_unittest.cc
AgeCommit message (Collapse)Author
2021-07-23[Zucchini] Format change: PatchElementHeader: Group fields by "old" and "new".Samuel Huang
Previously PatchElementHeader members were ordered by: [old_offset, new_offset, old_length, new_length]. This CL changes the order to [old_offset, old_length, new_offset, new_length] to be consistent with PatchHeader's grouping by "old" and "new". Also improve comments in patch_read_write_unittest.cc, and fix input value in PatchElementTest.WrongExtraData. Change-Id: I0dab56b7de1ba99f0a2f686dfebdf422a9d1c3b0 Reviewed-on: https://chromium-review.googlesource.com/1043073 Commit-Queue: Samuel Huang <huangs@chromium.org> Reviewed-by: Greg Thompson <grt@chromium.org> Cr-Commit-Position: refs/heads/master@{#556076} NOKEYCHECK=True GitOrigin-RevId: cfb444ca0a5d494fc7e7beb74b0481249249671a
2021-07-23[Zucchini]: Stricter patch readCalder Kitagawa
This enforces a stricter patch read in a few ways: - Raw Deltas of 0 are forbidden. These are unused values which have no meaning and should not appear. - Extra Data length must be equal to the size of the patch element minus the total length of equivalences. - Element match headers must have regions of nonzero length. This change also annotates a number of "unsafe" values read from the patch that could be sources of error later if unchecked. It also adds caveats about under what conditions emitted values are considered to be safe/unsafe. Bug: 837096 Change-Id: I1b7614d92b85c0a1546d8dccb7d371d28b2a4cd3 Reviewed-on: https://chromium-review.googlesource.com/1037186 Commit-Queue: Calder Kitagawa <ckitagawa@google.com> Reviewed-by: Samuel Huang <huangs@chromium.org> Reviewed-by: Greg Thompson <grt@chromium.org> Cr-Commit-Position: refs/heads/master@{#555396} NOKEYCHECK=True GitOrigin-RevId: 63f65c0a8b295b925c1dc92c7bed7625e7d99d46
2021-07-23[Zucchini] Validate equivalences on loadCalder Kitagawa
A follow-up to https://chromium-review.googlesource.com/c/chromium/src/+/1028575 This moves patch_apply logic to check bounds of an equivalences from the call site of GetNext() to an internal function in the patch_reader. This means the equivalence consumer can use the equivalences without checking anything to do with bounds. I have manually tested that this doesn't appear to break any existing valid patches and it appears to catch all the same errors change 1028575 fixed so I can safely reverse that change. BUG: 837096 Change-Id: I84ccd9e1493f32d16eace4dd8e67586f559220d3 Reviewed-on: https://chromium-review.googlesource.com/1028836 Commit-Queue: Calder Kitagawa <ckitagawa@google.com> Reviewed-by: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#554536} NOKEYCHECK=True GitOrigin-RevId: ce5642400b37f5ff2b0a1213522f984bca8a080a
2021-07-23[Zucchini] Update ExecutableType values.Calder Kitagawa
This change has some pros and some cons: Pros: - Human readable ExecType in patch/hex dumps as the ASCII is meaningful. - Can be done at next to no cost at compile time. - Assigning new values regardless of order of appearance in the enum is more flexible. No more concern over invalidating old patches as values will be more or less permanent once this change goes in. Cons: - Checking if an ExecutableType is valid requires O(n) time where n is the number of supported Exec types using a cast. Alternatively, we could maintain a sorted list of these types in memory to check against in O(log(n)) or could use a set but this is more memory. Overall not a huge deal since we only support ~9 types but it is worth understanding the tradeoffs. - Enums don't enforce value reuse so it is possible although highly unlikely we introduce a repeated value. However, given the use of the switch case casting requiring unique values this is very unlikely. Bug: 834932 Change-Id: I7bc14ea7b4434e60bb0dafa47178fb2c2c12dc7f Reviewed-on: https://chromium-review.googlesource.com/1020446 Commit-Queue: Calder Kitagawa <ckitagawa@google.com> Reviewed-by: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#553083} NOKEYCHECK=True GitOrigin-RevId: da4335f0d27c7fa14f6897ffeb0833d424860f7e
2021-07-23[Zucchini] Format change: Remove PatchType.Samuel Huang
Previously, Zucchini patches store a uint32_t PatchType enum that distinguishes among (0) raw patch, (1) single executable patch, and (2) ensemble patch. However, ever since every element (and gap) stores ExecutableType, this PatchType field has become a vestige. This CL simplifies Zucchini by removing PatchType, including in README.md and tests. This CL alters Zucchini patch format (removes 4 bytes); patches created across this change are incompatible. Bug: 729154 Change-Id: Ia5f467ba5e01720f5085ce87a5de88f678a64930 Reviewed-on: https://chromium-review.googlesource.com/981789 Commit-Queue: Samuel Huang <huangs@chromium.org> Reviewed-by: Greg Thompson <grt@chromium.org> Cr-Commit-Position: refs/heads/master@{#546621} NOKEYCHECK=True GitOrigin-RevId: 325bcee07f3eb9e3604c8aa0367ae7145025ddb6
2021-07-23[Zucchini] Move Zucchini from /chrome/installer/ to /components/.Samuel Huang
(Use "git log --follow" to see older revisions of files). /components/ is the most logical place to put Zucchini, which only depends on /base and /testing/gtest. This move also enables Zucchini to be used by the Component Updater. Details: - Move all files; run the following to change deps and guards: sed 's/chrome\/installer/components/' *.cc *.h -i sed 's/CHROME_INSTALLER/COMPONENTS/' *.cc *.h -i - Sorting works out pretty well! - Change all 'chrome/installer/zucchini' to 'components/zucchini' throughout other parts of the repo; sort if necessary. - Fix 6 'git cl lint' errors. - Change 1 Bind() usage to BindRepeated(). - Update OWNER. Bug: 729154 Change-Id: I50c5a7d411ea85f707b5994ab319dfb2a1acccf7 Reviewed-on: https://chromium-review.googlesource.com/954923 Reviewed-by: Greg Thompson <grt@chromium.org> Reviewed-by: Jochen Eisinger <jochen@chromium.org> Reviewed-by: Samuel Huang <huangs@chromium.org> Commit-Queue: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#542857} NOKEYCHECK=True GitOrigin-RevId: 577ef6c435e8d43be6e3e60ccbcbd1881780f4ec