Skip to contentSkip to conversation

erofs-utils: lib: gzran: fix corruption due to incorrect dictionary recovery

PATCH New Gao Xiang 1 participant 1 message Oct 24, 2025 Library code

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs-utils: lib: gzran: fix corruption due to incorrect dictionary recovery

The dictionary was incorrectly copied by only one byte, leading to corruption during gzran read.

Fix the memcpy size argument to copy the entire dictionary buffer instead of a single byte.

---
 lib/gzran.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/gzran.c +1 -1
index 47d660d..527a366 100644
@@ -362,7 +362,7 @@ struct erofs_vfile *erofs_gzran_zinfo_open(struct erofs_vfile *vin,
 	for (; i < ios->entries; ++i, ++c) {
 		ios->cp[i].in_bitpos = (le64_to_cpu(c->in) << 3) | c->bits;
 		ios->cp[i].outpos = le64_to_cpu(c->out);
-		memcpy(ios->cp[i].window, c->window, sizeof(*c->window));
+		memcpy(ios->cp[i].window, c->window, sizeof(c->window));
 	}
 	ios->vin = vin;
 	vf->ops = &erofs_gzran_ios_vfops;
Signature · 1 line
2.39.5