Commit Diff


commit - c9ab81f899e5ed4668d95cf5d250364c5ba50922
commit + a5abf1e2d9cdc9bbb71f02f8555d2055309541c5
blob - c2d370e2a67ee3320b3b7ed10179087ef21e2ecb
blob + 6782e47ee5cfbd3f96506e4eb59136d4d742d6f2
--- pdf.c
+++ pdf.c
@@ -2356,12 +2356,11 @@ parse_xrefs(const uint8_t *input, size_t sz, size_t *n
 		//res = h_parse(p_xref, input + offset, sz - offset);
 		HParser *p = h_right(h_seek(offset * 8, SEEK_SET), p_xref);	// XXX
 		res = h_parse(p, input, sz);
-		if (res == NULL) {
+		if (res == NULL || res->ast == NULL || H_INDEX_TOKEN(res->ast, 0) == NULL) {
 			fprintf(stderr, "%s: error parsing xref section at "
 			    "position %zu (%#zx)\n", infile, offset, offset);
 			break;
 		}
-		assert(res->ast != NULL);
 
 		/* save this section in xrefs */
 		if (n >= SIZE_MAX / sizeof(HParsedToken *))