summaryrefslogtreecommitdiffstats
path: root/applypatch/imgdiff.c
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2015-10-09 18:15:26 +0200
committerEthan Yonker <dees_troy@teamw.in>2015-10-09 18:15:29 +0200
commitc798c9cd2486e0ff83776002c74f113677b10a84 (patch)
treed128a80cbc58e63a622fda2774e727611f9d2cd4 /applypatch/imgdiff.c
parentAdd TW_IGNORE_ABS_MT_TRACKING_ID (diff)
parentmerge in mnc-release history after reset to mnc-dev (diff)
downloadandroid_bootable_recovery-c798c9cd2486e0ff83776002c74f113677b10a84.tar
android_bootable_recovery-c798c9cd2486e0ff83776002c74f113677b10a84.tar.gz
android_bootable_recovery-c798c9cd2486e0ff83776002c74f113677b10a84.tar.bz2
android_bootable_recovery-c798c9cd2486e0ff83776002c74f113677b10a84.tar.lz
android_bootable_recovery-c798c9cd2486e0ff83776002c74f113677b10a84.tar.xz
android_bootable_recovery-c798c9cd2486e0ff83776002c74f113677b10a84.tar.zst
android_bootable_recovery-c798c9cd2486e0ff83776002c74f113677b10a84.zip
Diffstat (limited to '')
-rw-r--r--applypatch/imgdiff.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/applypatch/imgdiff.c b/applypatch/imgdiff.c
index 05c4f250f..3bac8be91 100644
--- a/applypatch/imgdiff.c
+++ b/applypatch/imgdiff.c
@@ -408,6 +408,7 @@ unsigned char* ReadImage(const char* filename,
p[2] == 0x08 && // deflate compression
p[3] == 0x00) { // no header flags
// 'pos' is the offset of the start of a gzip chunk.
+ size_t chunk_offset = pos;
*num_chunks += 3;
*chunks = realloc(*chunks, *num_chunks * sizeof(ImageChunk));
@@ -453,6 +454,14 @@ unsigned char* ReadImage(const char* filename,
strm.avail_out = allocated - curr->len;
strm.next_out = curr->data + curr->len;
ret = inflate(&strm, Z_NO_FLUSH);
+ if (ret < 0) {
+ printf("Error: inflate failed [%s] at file offset [%zu]\n"
+ "imgdiff only supports gzip kernel compression,"
+ " did you try CONFIG_KERNEL_LZO?\n",
+ strm.msg, chunk_offset);
+ free(img);
+ return NULL;
+ }
curr->len = allocated - strm.avail_out;
if (strm.avail_out == 0) {
allocated *= 2;