summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2023-06-15 23:44:50 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-06-15 23:44:50 +0000
commit1eec465beb1c9f6c938cff0c959037f7d498c4bd (patch)
tree3c9ee91265f4ec3eaaa9c1587eba03dfdb5b8f2a
parent364dcb27baf5082784dc8d2c3aef3c290a726818 (diff)
parent6fd01a93b57a83fafd428c9782c85b6b68e5057b (diff)
downloadbsdiff-1eec465beb1c9f6c938cff0c959037f7d498c4bd.tar.gz
Merge "Exit loop earlier for bsdiff's pathological case" am: d3f0369732 am: 6fd01a93b5
Original change: https://android-review.googlesource.com/c/platform/external/bsdiff/+/2627658 Change-Id: I3173d13640172adf1a1b3b116d4b5d0fa1a560b6 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--bsdiff.cc2
-rw-r--r--patch_writer.cc5
2 files changed, 2 insertions, 5 deletions
diff --git a/bsdiff.cc b/bsdiff.cc
index 8bb21b7..a1112d5 100644
--- a/bsdiff.cc
+++ b/bsdiff.cc
@@ -119,7 +119,7 @@ int bsdiff(const uint8_t* old_buf, size_t oldsize, const uint8_t* new_buf,
oldscore++;
if(((len==oldscore) && (len!=0)) ||
- (len>oldscore+8 && len>=min_length)) break;
+ (len>=oldscore+8 && len>=min_length)) break;
if((scan+lastoffset<oldsize) &&
(old_buf[scan+lastoffset] == new_buf[scan]))
diff --git a/patch_writer.cc b/patch_writer.cc
index b7d9b08..83bc531 100644
--- a/patch_writer.cc
+++ b/patch_writer.cc
@@ -13,10 +13,6 @@
#include "bsdiff/control_entry.h"
#include "bsdiff/logging.h"
-namespace {
-
-
-} // namespace
namespace bsdiff {
@@ -43,6 +39,7 @@ bool BsdiffPatchWriter::InitializeCompressorList(
LOG(ERROR) << "Patch writer expects at least one compressor.";
return false;
}
+ compressor_list->clear();
for (const auto& type : types_) {
switch (type) {