diff --git a/pdf.c b/pdf.c index 4e159a39308ae3a089a6319e3e6227172b84d5a8..c1652fb3cecf649ef9f0fb67ec86c3f24c612e00 100644 --- a/pdf.c +++ b/pdf.c @@ -4986,10 +4986,8 @@ parse_xrefs(const uint8_t *input, size_t sz, size_t *nxrefs) // 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);