Browse code

bb#4315

aCaB authored on 2012/02/29 22:11:04
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Wed Feb 29 14:09:18 CET 2012 (acab)
2
+-----------------------------------
3
+ * libclamav/pdf.c: scan the whole trailer for /H (bb#4315)
4
+
1 5
 Tue Feb  7 23:23:48 CET 2012 (tk)
2 6
 ---------------------------------
3 7
  * libclamav: fix bytecode whitelisting
... ...
@@ -1268,7 +1268,7 @@ static void pdf_parseobj(struct pdf_struct *pdf, struct pdf_obj *obj)
1268 1268
     const char *q2, *q3, *q4;
1269 1269
     const char *q = obj->start + pdf->map;
1270 1270
     const char *dict, *start;
1271
-    off_t dict_length;
1271
+    off_t dict_length, full_dict_length;
1272 1272
     off_t bytesleft = obj_size(pdf, obj, 1);
1273 1273
     unsigned i, filters=0;
1274 1274
     enum objstate objstate = STATE_NONE;
... ...
@@ -1319,7 +1319,7 @@ static void pdf_parseobj(struct pdf_struct *pdf, struct pdf_obj *obj)
1319 1319
     } while (!q4 || q4[1] != '>');
1320 1320
     if (!q4) q4 = q3;
1321 1321
     obj->flags |= 1 << OBJ_DICT;
1322
-    dict_length = q4 - dict;
1322
+    full_dict_length = dict_length = q4 - dict;
1323 1323
 
1324 1324
     /*  process pdf names */
1325 1325
     for (q = dict;dict_length > 0;) {
... ...
@@ -1354,7 +1354,7 @@ static void pdf_parseobj(struct pdf_struct *pdf, struct pdf_obj *obj)
1354 1354
 	    long trailer_end, trailer;
1355 1355
 	    pdfobj_flag(pdf, obj, LINEARIZED_PDF);
1356 1356
 	    objstate = STATE_NONE;
1357
-	    trailer_end = pdf_readint(q, dict_length, "/H");
1357
+	    trailer_end = pdf_readint(dict, full_dict_length, "/H");
1358 1358
 	    if (trailer_end > 0 && trailer_end < pdf->size) {
1359 1359
 		const char *enc;
1360 1360
 		trailer = trailer_end - 1024;