summaryrefslogtreecommitdiff
path: root/src/adb_comp.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2021-07-21 16:13:39 +0300
committerTimo Teräs <timo.teras@iki.fi>2021-07-22 16:14:49 +0300
commit2f1186aa404ea86eb53ad89ec2df315e607f90aa (patch)
tree1de8e1399ce6a070a5f6b3067d11c884c161c506 /src/adb_comp.c
parent05364528bbb5e1300187da3c3df474b9eaee2138 (diff)
downloadapk-tools-2f1186aa404ea86eb53ad89ec2df315e607f90aa.tar.gz
apk-tools-2f1186aa404ea86eb53ad89ec2df315e607f90aa.tar.bz2
apk-tools-2f1186aa404ea86eb53ad89ec2df315e607f90aa.tar.xz
apk-tools-2f1186aa404ea86eb53ad89ec2df315e607f90aa.zip
adb: make adb mmap/stream parser more united, add ADB_BLOCK_DATAX
Harden the error checking of expected block types and their order. Add ADB_BLOCK_DATAX as reserved for >1GB blocks.
Diffstat (limited to 'src/adb_comp.c')
-rw-r--r--src/adb_comp.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/adb_comp.c b/src/adb_comp.c
index 9f339b8..b697101 100644
--- a/src/adb_comp.c
+++ b/src/adb_comp.c
@@ -16,6 +16,7 @@ struct apk_istream *adb_decompress(struct apk_istream *is, adb_comp_t *compressi
if (IS_ERR_OR_NULL(is)) return is;
uint8_t *buf = apk_istream_peek(is, 4);
+ if (IS_ERR(buf)) return ERR_PTR(apk_istream_close_error(is, PTR_ERR(buf)));
if (memcmp(buf, "ADB", 3) == 0) switch (buf[3]) {
case '.':
c = ADB_COMP_NONE;