shithub: pdffs

Download patch

ref: da441c02a9e592574acee7ba02799e05376e30f2
parent: 52ffbd2fcf4ca85fe9958b9aa977e53175234235
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Sat Nov 21 15:25:18 EST 2020

object: print the position of the unexpected char

--- a/object.c
+++ b/object.c
@@ -13,10 +13,10 @@
 pdfobj(Pdf *pdf, Stream *s)
 {
 	Object *o, *o2;
-	char b[16];
 	vlong off;
 	int c, tf;
 	Xref xref;
+	char b[16];
 
 	o = o2 = nil;
 	do; while(isws(c = Sgetc(s)));
@@ -111,7 +111,7 @@
 		if(!isdigit(c) && c != '-'){
 unexpected:
 			Sungetc(s);
-			werrstr("unexpected char '%c'", c);
+			werrstr("unexpected char '%c' at %#x+%#x (%d left)", c, Sobjoffset(s), Soffset(s), Ssize(s));
 			goto err;
 		}
 		 /* it could be a number or an indirect object */