diff --git a/pdf.c b/pdf.c
index 37baee6faa43c2353007c774abb6f02299fc3ad7..c2d370e2a67ee3320b3b7ed10179087ef21e2ecb 100644
--- a/pdf.c
+++ b/pdf.c
@@ -855,7 +855,7 @@ act_rldstring(const HParseResult *p, void *u)
 {
 	const HParsedToken *flattened = h_seq_flatten(p->arena, p->ast);
 	HCountedArray *flattened_seq = H_CAST_SEQ(flattened);
-	uint8_t bytes_required;
+	size_t bytes_required;
 	uint8_t *result_bytes;
 
 	bytes_required = flattened_seq->used - 1;