extract_v3: fix extraction of zero length files
The apk_istream is null for zero length files, and needs special handling. fixes #10784cute-signatures
parent
c60b7424a0
commit
9d7b4bd253
|
@ -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);
|
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));
|
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;
|
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));
|
r = ectx->ops->file(ectx, &fi, apk_istream_verify(&dis, is, fi.size, &fi.digest));
|
||||||
return apk_istream_close_error(&dis.is, r);
|
return apk_istream_close_error(&dis.is, r);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue