import: finalize decompressor

Otherwise, the result may be truncated, or trailing garbage may be
silently accepted.
This commit is contained in:
Yu Watanabe
2026-08-27 04:36:57 +09:00
parent dac2b39405
commit d8c0fa3cb8
+5
View File
@@ -421,6 +421,11 @@ static int pull_job_curl_on_finished(CurlSlot *slot, CURL *curl, CURLcode result
if (j->state != PULL_JOB_RUNNING)
return pull_job_finish(j, log_error_errno(SYNTHETIC_ERRNO(EIO), "Premature connection termination."));
/* Finalize decompressor. */
r = decompressor_push(j->compress, /* data= */ NULL, /* size= */ 0, pull_job_write_uncompressed, j);
if (r < 0)
return pull_job_finish(j, r);
uint64_t cl = pull_job_content_length_effective(j);
if (cl != UINT64_MAX &&
cl != j->written_compressed)