... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Mon Oct 18 13:55:17 EEST 2010 (edwin) |
|
2 |
+------------------------------------- |
|
3 |
+ * libclamav/pdf.c: bb #2295 |
|
4 |
+ |
|
1 | 5 |
Mon Oct 18 13:46:59 EEST 2010 (edwin) |
2 | 6 |
------------------------------------- |
3 | 7 |
* libclamav/builtin_bytecodes.h: disable JIT on CPUs without CMOV (bb #2327). |
... | ... |
@@ -899,7 +899,7 @@ static void pdf_parseobj(struct pdf_struct *pdf, struct pdf_obj *obj) |
899 | 899 |
dict_length = q3 - dict; |
900 | 900 |
|
901 | 901 |
/* process pdf names */ |
902 |
- for (q = dict;dict_length;) { |
|
902 |
+ for (q = dict;dict_length > 0;) { |
|
903 | 903 |
int escapes = 0; |
904 | 904 |
q2 = memchr(q, '/', dict_length); |
905 | 905 |
if (!q2) |
... | ... |
@@ -907,7 +907,7 @@ static void pdf_parseobj(struct pdf_struct *pdf, struct pdf_obj *obj) |
907 | 907 |
dict_length -= q2 - q; |
908 | 908 |
q = q2; |
909 | 909 |
/* normalize PDF names */ |
910 |
- for (i = 0;dict_length && (i < sizeof(pdfname)-1); i++) { |
|
910 |
+ for (i = 0;dict_length > 0 && (i < sizeof(pdfname)-1); i++) { |
|
911 | 911 |
q++; |
912 | 912 |
dict_length--; |
913 | 913 |
if (*q == '#') { |
... | ... |
@@ -929,8 +929,8 @@ static void pdf_parseobj(struct pdf_struct *pdf, struct pdf_obj *obj) |
929 | 929 |
pdfobj_flag(pdf, obj, LINEARIZED_PDF); |
930 | 930 |
objstate = STATE_NONE; |
931 | 931 |
} |
932 |
- if (objstate == STATE_JAVASCRIPT || |
|
933 |
- objstate == STATE_OPENACTION) { |
|
932 |
+ if (dict_length > 0 && (objstate == STATE_JAVASCRIPT || |
|
933 |
+ objstate == STATE_OPENACTION)) { |
|
934 | 934 |
if (objstate == STATE_OPENACTION) |
935 | 935 |
pdfobj_flag(pdf, obj, HAS_OPENACTION); |
936 | 936 |
q2 = pdf_nextobject(q, dict_length); |
... | ... |
@@ -941,7 +941,7 @@ static void pdf_parseobj(struct pdf_struct *pdf, struct pdf_obj *obj) |
941 | 941 |
if (q2 && isdigit(*q2)) { |
942 | 942 |
objid |= atoi(q2) & 0xff; |
943 | 943 |
q2 = pdf_nextobject(q2, dict_length); |
944 |
- if (*q2 == 'R') { |
|
944 |
+ if (q2 && *q2 == 'R') { |
|
945 | 945 |
struct pdf_obj *obj2; |
946 | 946 |
cli_dbgmsg("cli_pdf: found %s stored in indirect object %u %u\n", |
947 | 947 |
pdfname, |