diff --git a/pdf.c b/pdf.c
index 3e5e6303bf7b299acc1c4071f5c1e02f21ea313f..9da7fcc87fc134d73d654a1b7999db4e1b8343a7 100644
--- a/pdf.c
+++ b/pdf.c
@@ -1415,6 +1415,10 @@ parse_xrefs(const char *input, size_t sz, size_t *nxrefs)
 			fprintf(stderr, "%s: /Prev not an integer\n", infile);
 			break;
 		}
+		if (tok->sint < 0) {
+			fprintf(stderr, "%s: /Prev negative\n", infile);
+			break;
+		}
 
 		/*
 		 * validate the new offset. we don't want to get caught in a