|
Lines 115-137
Link Here
|
| 115 |
GBool PDFDoc::setup(GString *ownerPassword, GString *userPassword) { |
115 |
GBool PDFDoc::setup(GString *ownerPassword, GString *userPassword) { |
| 116 |
str->reset(); |
116 |
str->reset(); |
| 117 |
|
117 |
|
| 118 |
char eof[8]; |
118 |
char *eof = new char[1024]; |
| 119 |
int pos = str->getPos(); |
119 |
int pos = str->getPos(); |
| 120 |
str->setPos(7, -1); |
120 |
str->setPos(1024, -1); |
| 121 |
eof[0] = str->getChar(); |
121 |
for (int i = 0; i < 1024; i++) eof[i] = str->getChar(); |
| 122 |
eof[1] = str->getChar(); |
122 |
eof[1024] = '\0' |
| 123 |
eof[2] = str->getChar(); |
|
|
| 124 |
eof[3] = str->getChar(); |
| 125 |
eof[4] = str->getChar(); |
| 126 |
eof[5] = str->getChar(); |
| 127 |
eof[6] = str->getChar(); |
| 128 |
eof[7] = '\0'; |
| 129 |
if (strstr(eof, "%%EOF") == NULL) |
123 |
if (strstr(eof, "%%EOF") == NULL) |
| 130 |
{ |
124 |
{ |
| 131 |
error(-1, "Document does not have ending %%EOF"); |
125 |
error(-1, "Document does not have ending %%EOF"); |
| 132 |
errCode = errDamaged; |
126 |
errCode = errDamaged; |
|
|
127 |
delete[] eof; |
| 133 |
return gFalse; |
128 |
return gFalse; |
| 134 |
} |
129 |
} |
|
|
130 |
delete[] eof; |
| 135 |
|
131 |
|
| 136 |
str->setPos(pos); |
132 |
str->setPos(pos); |
| 137 |
|
133 |
|