:: commit 0e0ec3aa2def020344c4c01175b2d63bdd65e97c

Mintsuki <mintsuki@protonmail.com> — 2026-04-24 04:11

parents: ec97f1ddf9

compress/gzip: Honor fread return value in pdgzip source callback

diff --git a/common/compress/gzip.c b/common/compress/gzip.c
index 345a91bb..504cad9a 100644
--- a/common/compress/gzip.c
+++ b/common/compress/gzip.c
@@ -56,9 +56,9 @@ static size_t gz_source_read(void * user, void * buf, size_t len) {
   uint64_t avail = gh->source->size - gh->src_pos;
   if ((uint64_t)len > avail) len = (size_t)avail;
   if (len == 0) return 0;
-  fread(gh->source, buf, gh->src_pos, len);
-  gh->src_pos += len;
-  return len;
+  size_t got = fread(gh->source, buf, gh->src_pos, len);
+  gh->src_pos += got;
+  return got;
 }
 
 /*  (Re)initialize the decoder for a fresh pass over the compressed stream.
tab: 248 wrap: offon