Commit Diff


commit - dd3c8e62ac41add9bad416af8b71cc5db02de029
commit + 9196b5c2b80d606f09cde523b1931d6c9c921692
blob - 4e159a39308ae3a089a6319e3e6227172b84d5a8
blob + c1652fb3cecf649ef9f0fb67ec86c3f24c612e00
--- pdf.c
+++ pdf.c
@@ -4986,10 +4986,8 @@ parse_xrefs(const uint8_t *input, size_t sz, size_t *n
 
 	// XXX try formulating this loop as one parser using h_seek and h_bind
 	for (;;) {
-		//res = h_parse(p_xref, input + offset, sz - offset);
-		HParser *p = h_right(h_seek(offset * 8, SEEK_SET), p_xref);
-			// XXX ^ creating any number of parsers we never free
-		res = h_parse(p, input, sz);
+		assert(offset <= sz);
+		res = h_parse(p_xref, input + offset, sz - offset);
 		if (res == NULL || res->ast == NULL || H_INDEX_TOKEN(res->ast, 0) == NULL) {
 			log_message(5, "VIOLATION[5]: error parsing xref section at "
 			    "position %zu (%#zx)\n", offset, offset);