shithub: pdffs

Download patch

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

flate filter: ignore trailing garbage

--- a/f_flate.c
+++ b/f_flate.c
@@ -93,10 +93,11 @@
 		r = inflatezlib(bo, bw, bi, bget);
 	}while(r == FlateOk && !bufeof(bi));
 
-	if(r != FlateOk){
+	if(r != FlateOk && bufleft(bo) < 1){
 		werrstr("%s", flateerr(r));
 		return -1;
 	}
+	r = 0;
 
 	/* 7.4.4.4 LZW and Flate predictor functions */
 	if(fp->predictor >= 10 && fp->columns > 0){