diff options
author | Timo Teräs <timo.teras@iki.fi> | 2021-11-11 11:21:04 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2021-11-11 11:22:06 +0200 |
commit | 9d7b4bd25314dd4c726106e6573d20a34ee2e70d (patch) | |
tree | 8d8acade31c1bd6cc4ef08cdc46ff31c6edfa636 /src/extract_v3.c | |
parent | c60b7424a0e0b12540112bc14d42f3214f214cd6 (diff) | |
download | apk-tools-9d7b4bd25314dd4c726106e6573d20a34ee2e70d.tar.gz apk-tools-9d7b4bd25314dd4c726106e6573d20a34ee2e70d.tar.bz2 apk-tools-9d7b4bd25314dd4c726106e6573d20a34ee2e70d.tar.xz apk-tools-9d7b4bd25314dd4c726106e6573d20a34ee2e70d.zip |
extract_v3: fix extraction of zero length files
The apk_istream is null for zero length files, and needs
special handling.
fixes #10784
Diffstat (limited to 'src/extract_v3.c')
-rw-r--r-- | src/extract_v3.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/extract_v3.c b/src/extract_v3.c index c25b2ae..65e8a59 100644 --- a/src/extract_v3.c +++ b/src/extract_v3.c @@ -77,10 +77,11 @@ static int apk_extract_v3_file(struct apk_extract_ctx *ectx, off_t sz, struct ap return ectx->ops->file(ectx, &fi, is); } + fi.mode |= S_IFREG; + if (!is) return ectx->ops->file(ectx, &fi, 0); + apk_digest_from_blob(&fi.digest, adb_ro_blob(&ctx->file, ADBI_FI_HASHES)); if (fi.digest.alg == APK_DIGEST_NONE) return -APKE_ADB_SCHEMA; - - fi.mode |= S_IFREG; r = ectx->ops->file(ectx, &fi, apk_istream_verify(&dis, is, fi.size, &fi.digest)); return apk_istream_close_error(&dis.is, r); } |