summaryrefslogtreecommitdiffstats
path: root/applypatch/imgpatch.cpp
diff options
context:
space:
mode:
authorSen Jiang <senj@google.com>2016-02-02 09:01:23 +0100
committerSen Jiang <senj@google.com>2016-02-10 00:26:57 +0100
commit696692a3c9fe4bd8879f98f3e85341303f85afd5 (patch)
treed01dfa7f2b65b703ab83fc9e47fed61e67f97d85 /applypatch/imgpatch.cpp
parentMerge "verifier_test: Suppress the unused parameter warnings." (diff)
downloadandroid_bootable_recovery-696692a3c9fe4bd8879f98f3e85341303f85afd5.tar
android_bootable_recovery-696692a3c9fe4bd8879f98f3e85341303f85afd5.tar.gz
android_bootable_recovery-696692a3c9fe4bd8879f98f3e85341303f85afd5.tar.bz2
android_bootable_recovery-696692a3c9fe4bd8879f98f3e85341303f85afd5.tar.lz
android_bootable_recovery-696692a3c9fe4bd8879f98f3e85341303f85afd5.tar.xz
android_bootable_recovery-696692a3c9fe4bd8879f98f3e85341303f85afd5.tar.zst
android_bootable_recovery-696692a3c9fe4bd8879f98f3e85341303f85afd5.zip
Diffstat (limited to 'applypatch/imgpatch.cpp')
-rw-r--r--applypatch/imgpatch.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/applypatch/imgpatch.cpp b/applypatch/imgpatch.cpp
index 8824038ea..0ab995b30 100644
--- a/applypatch/imgpatch.cpp
+++ b/applypatch/imgpatch.cpp
@@ -130,6 +130,7 @@ int ApplyImagePatch(const unsigned char* old_data, ssize_t old_size,
size_t src_len = Read8(deflate_header+8);
size_t patch_offset = Read8(deflate_header+16);
size_t expanded_len = Read8(deflate_header+24);
+ size_t target_len = Read8(deflate_header+32);
int level = Read4(deflate_header+40);
int method = Read4(deflate_header+44);
int windowBits = Read4(deflate_header+48);
@@ -195,6 +196,11 @@ int ApplyImagePatch(const unsigned char* old_data, ssize_t old_size,
&uncompressed_target_data) != 0) {
return -1;
}
+ if (uncompressed_target_data.size() != target_len) {
+ printf("expected target len to be %zu, but it's %zu\n",
+ target_len, uncompressed_target_data.size());
+ return -1;
+ }
// Now compress the target data and append it to the output.