Browse code

pdf: filter order tracking implementation (max:64)

Kevin Lin authored on 2016/03/29 02:16:17
Showing 2 changed files
... ...
@@ -1429,6 +1429,10 @@ static void handle_pdfname(struct pdf_struct *pdf, struct pdf_obj *obj, const ch
1429 1429
         return;
1430 1430
     }
1431 1431
 
1432
+    /* record filter order */
1433
+    if ((*state == STATE_FILTER) && ((1 << act->set_objflag) & KNOWN_FILTERS))
1434
+        obj->filterlist[obj->numfilters++] = act->set_objflag;
1435
+
1432 1436
     if ((act->nameflags & NAMEFLAG_HEURISTIC) && escapes) {
1433 1437
         /* if a commonly used PDF name is escaped that is certainly
1434 1438
            suspicious. */
... ...
@@ -22,11 +22,14 @@
22 22
 #define __PDF_H
23 23
 
24 24
 #include "others.h"
25
+#define PDF_FILTERLIST_MAX 64
25 26
 struct pdf_obj {
26 27
     uint32_t start;
27 28
     uint32_t id;
28 29
     uint32_t flags;
29 30
     uint32_t statsflags;
31
+    uint32_t numfilters;
32
+    uint32_t filterlist[PDF_FILTERLIST_MAX];
30 33
     char *path;
31 34
 };
32 35