...
|
...
|
@@ -955,13 +955,15 @@ static void pdf_parseobj(struct pdf_struct *pdf, struct pdf_obj *obj)
|
955
|
955
|
pdfobj_flag(pdf, obj, LINEARIZED_PDF);
|
956
|
956
|
objstate = STATE_NONE;
|
957
|
957
|
trailer_end = pdf_readint(q, dict_length, "/H");
|
958
|
|
- trailer = trailer_end - 1024;
|
959
|
|
- if (trailer < 0) trailer = 0;
|
960
|
|
- q2 = pdf->map + trailer;
|
961
|
|
- cli_dbgmsg("cli_pdf: looking for trailer in linearized pdf: %ld - %ld\n", trailer, trailer_end);
|
962
|
|
- pdf->fileID = pdf_readstring(q2, trailer_end - trailer, "/ID", &pdf->fileIDlen);
|
963
|
|
- if (pdf->fileID)
|
964
|
|
- cli_dbgmsg("found fileID\n");
|
|
958
|
+ if (trailer_end > 0) {
|
|
959
|
+ trailer = trailer_end - 1024;
|
|
960
|
+ if (trailer < 0) trailer = 0;
|
|
961
|
+ q2 = pdf->map + trailer;
|
|
962
|
+ cli_dbgmsg("cli_pdf: looking for trailer in linearized pdf: %ld - %ld\n", trailer, trailer_end);
|
|
963
|
+ pdf->fileID = pdf_readstring(q2, trailer_end - trailer, "/ID", &pdf->fileIDlen);
|
|
964
|
+ if (pdf->fileID)
|
|
965
|
+ cli_dbgmsg("found fileID\n");
|
|
966
|
+ }
|
965
|
967
|
}
|
966
|
968
|
if (objstate == STATE_LAUNCHACTION)
|
967
|
969
|
pdfobj_flag(pdf, obj, HAS_LAUNCHACTION);
|
...
|
...
|
@@ -1054,6 +1056,10 @@ static const char *pdf_getdict(const char *q0, int* len, const char *key)
|
1054
|
1054
|
{
|
1055
|
1055
|
const char *q;
|
1056
|
1056
|
|
|
1057
|
+ if (*len <= 0) {
|
|
1058
|
+ cli_dbgmsg("cli_pdf: bad length %d\n", *len);
|
|
1059
|
+ return NULL;
|
|
1060
|
+ }
|
1057
|
1061
|
q = cli_memstr(q0, *len, key, strlen(key));
|
1058
|
1062
|
if (!q) {
|
1059
|
1063
|
cli_dbgmsg("cli_pdf: %s not found in dict\n", key);
|