summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRahul Chaudhry <rahulchaudhry@google.com>2016-11-30 02:10:14 +0100
committerRahul Chaudhry <rahulchaudhry@google.com>2016-11-30 20:18:32 +0100
commita793c58208bc54fe83c5aa0e456a66ee2609e408 (patch)
tree3bb62fcce970c8433f7e70a7b03af8bacaca8b99
parentMerge "Remove ota_close(int) and ota_fclose(FILE*)." (diff)
downloadandroid_bootable_recovery-a793c58208bc54fe83c5aa0e456a66ee2609e408.tar
android_bootable_recovery-a793c58208bc54fe83c5aa0e456a66ee2609e408.tar.gz
android_bootable_recovery-a793c58208bc54fe83c5aa0e456a66ee2609e408.tar.bz2
android_bootable_recovery-a793c58208bc54fe83c5aa0e456a66ee2609e408.tar.lz
android_bootable_recovery-a793c58208bc54fe83c5aa0e456a66ee2609e408.tar.xz
android_bootable_recovery-a793c58208bc54fe83c5aa0e456a66ee2609e408.tar.zst
android_bootable_recovery-a793c58208bc54fe83c5aa0e456a66ee2609e408.zip
Diffstat (limited to '')
-rw-r--r--applypatch/imgdiff.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/applypatch/imgdiff.cpp b/applypatch/imgdiff.cpp
index f6087de01..77c19ad97 100644
--- a/applypatch/imgdiff.cpp
+++ b/applypatch/imgdiff.cpp
@@ -320,6 +320,10 @@ unsigned char* ReadZip(const char* filename,
// -15 means we are decoding a 'raw' deflate stream; zlib will
// not expect zlib headers.
int ret = inflateInit2(&strm, -15);
+ if (ret < 0) {
+ printf("failed to initialize inflate: %d\n", ret);
+ return NULL;
+ }
strm.avail_out = curr->len;
strm.next_out = curr->data;
@@ -445,6 +449,10 @@ unsigned char* ReadImage(const char* filename,
// -15 means we are decoding a 'raw' deflate stream; zlib will
// not expect zlib headers.
int ret = inflateInit2(&strm, -15);
+ if (ret < 0) {
+ printf("failed to initialize inflate: %d\n", ret);
+ return NULL;
+ }
do {
strm.avail_out = allocated - curr->len;
@@ -552,10 +560,18 @@ int TryReconstruction(ImageChunk* chunk, unsigned char* out) {
int ret;
ret = deflateInit2(&strm, chunk->level, chunk->method, chunk->windowBits,
chunk->memLevel, chunk->strategy);
+ if (ret < 0) {
+ printf("failed to initialize deflate: %d\n", ret);
+ return -1;
+ }
do {
strm.avail_out = BUFFER_SIZE;
strm.next_out = out;
ret = deflate(&strm, Z_FINISH);
+ if (ret < 0) {
+ printf("failed to deflate: %d\n", ret);
+ return -1;
+ }
size_t have = BUFFER_SIZE - strm.avail_out;
if (memcmp(out, chunk->deflate_data+p, have) != 0) {