shithub: jbig2

Download patch

ref: 6ec587de8f72e50071ab751c8f1ecdce91bb8be7
parent: 0a396e48949d90a8cd1a91c685af09a165a1f5d9
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Wed Jun 2 08:29:45 EDT 2021

remove header injection: pdffs does that now

--- a/jb2.c
+++ b/jb2.c
@@ -16,8 +16,6 @@
 void
 main(int argc, char **argv)
 {
-	/* this header is inserted in case the input stream doesn't have one (when extracted from a PDF) */
-	uchar header[] = { 0x97, 0x4a, 0x42, 0x32, 0x0d, 0x0a, 0x1a, 0x0a, 0x01, 0x00, 0x00, 0x00, 0x01 };
     int n, w, h, x, y, page;
 	uchar *rgb, d[8192];
 	Jbig2Image *j;
@@ -42,13 +40,11 @@
 		werrstr("ctx_new");
 		goto error;
 	}
-	for(x = 0;; x += n){
+	for(;;){
 		if((n = read(0, d, sizeof(d))) == 0)
 			break;
 		if(n < 0)
 			goto error;
-		if(x == 0 && n >= 8 && memcmp(d, header, 8) != 0)
-			jbig2_data_in(ctx, header, sizeof(header));
 		if(jbig2_data_in(ctx, d, n) < 0){
 			werrstr("data_in");
 			goto error;