git-svn: trunk@2999
Nigel Horne authored on 2007/03/31 06:18:37... | ... |
@@ -1,3 +1,11 @@ |
1 |
+Fri Mar 30 21:17:54 BST 2007 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav/pdf.c: Bug 396 |
|
4 |
+ |
|
5 |
+Fri Mar 30 10:30:11 BST 2007 (njh) |
|
6 |
+---------------------------------- |
|
7 |
+ * libclamav/pdf.c, clamav-milter: Better diagnostics |
|
8 |
+ |
|
1 | 9 |
Thu Mar 29 12:41:17 CEST 2007 (tk) |
2 | 10 |
---------------------------------- |
3 | 11 |
* clamscan: fix compilation error |
... | ... |
@@ -55,7 +55,7 @@ static char const rcsid[] = "$Id: pdf.c,v 1.61 2007/02/12 20:46:09 njh Exp $"; |
55 | 55 |
#include "pdf.h" |
56 | 56 |
|
57 | 57 |
#ifdef CL_DEBUG |
58 |
-/*#define SAVE_TMP /* Save the file being worked on in tmp */ |
|
58 |
+#define SAVE_TMP /* Save the file being worked on in tmp */ |
|
59 | 59 |
#endif |
60 | 60 |
|
61 | 61 |
static int try_flatedecode(unsigned char *buf, off_t real_len, off_t calculated_len, int fout, const cli_ctx *ctx); |
... | ... |
@@ -371,7 +371,6 @@ cli_pdf(const char *dir, int desc, const cli_ctx *ctx) |
371 | 371 |
len -= (int)(q - streamstart); |
372 | 372 |
streamstart = q; |
373 | 373 |
streamend = cli_pmemstr(streamstart, len, "endstream\n", 10); |
374 |
- has_cr = 0; |
|
375 | 374 |
if(streamend == NULL) { |
376 | 375 |
streamend = cli_pmemstr(streamstart, len, "endstream\r", 10); |
377 | 376 |
if(streamend == NULL) { |
... | ... |
@@ -379,7 +378,8 @@ cli_pdf(const char *dir, int desc, const cli_ctx *ctx) |
379 | 379 |
break; |
380 | 380 |
} |
381 | 381 |
has_cr = 1; |
382 |
- } |
|
382 |
+ } else |
|
383 |
+ has_cr = 0; |
|
383 | 384 |
snprintf(fullname, sizeof(fullname), "%s/pdfXXXXXX", dir); |
384 | 385 |
#if defined(C_LINUX) || defined(C_BSD) || defined(HAVE_MKSTEMP) || defined(C_SOLARIS) || defined(C_CYGWIN) |
385 | 386 |
fout = mkstemp(fullname); |
... | ... |
@@ -592,7 +592,7 @@ flatedecode(unsigned char *buf, off_t len, int fout, const cli_ctx *ctx) |
592 | 592 |
|
593 | 593 |
nbytes = 0; |
594 | 594 |
|
595 |
- for(;;) { |
|
595 |
+ while(stream.avail_in) { |
|
596 | 596 |
zstat = inflate(&stream, Z_NO_FLUSH); /* zlib */ |
597 | 597 |
switch(zstat) { |
598 | 598 |
case Z_OK: |