67 lines
2.0 KiB
Diff
67 lines
2.0 KiB
Diff
diff -Nuar poppler-0.67.0/utils/pdfdetach.cc poppler-0.67.0-old/utils/pdfdetach.cc
|
|
--- poppler-0.67.0/utils/pdfdetach.cc 2021-01-18 15:08:35.960000000 +0800
|
|
+++ poppler-0.67.0-old/utils/pdfdetach.cc 2021-01-18 15:29:05.580000000 +0800
|
|
@@ -190,14 +190,18 @@
|
|
fileSpec = static_cast<FileSpec *>(embeddedFiles->get(i));
|
|
printf("%d: ", i+1);
|
|
s1 = fileSpec->getFileName();
|
|
- if ((s1->getChar(0) & 0xff) == 0xfe && (s1->getChar(1) & 0xff) == 0xff) {
|
|
+ if (!s1) {
|
|
+ exitCode = 3;
|
|
+ goto err2;
|
|
+ }
|
|
+ if (s1->hasUnicodeMarker()) {
|
|
isUnicode = gTrue;
|
|
j = 2;
|
|
} else {
|
|
isUnicode = gFalse;
|
|
j = 0;
|
|
}
|
|
- while (j < fileSpec->getFileName()->getLength()) {
|
|
+ while (j < s1->getLength()) {
|
|
if (isUnicode) {
|
|
u = ((s1->getChar(j) & 0xff) << 8) | (s1->getChar(j+1) & 0xff);
|
|
j += 2;
|
|
@@ -227,14 +231,18 @@
|
|
p = path;
|
|
}
|
|
s1 = fileSpec->getFileName();
|
|
- if ((s1->getChar(0) & 0xff) == 0xfe && (s1->getChar(1) & 0xff) == 0xff) {
|
|
+ if (!s1) {
|
|
+ exitCode = 3;
|
|
+ goto err2;
|
|
+ }
|
|
+ if (s1->hasUnicodeMarker()) {
|
|
isUnicode = gTrue;
|
|
j = 2;
|
|
} else {
|
|
isUnicode = gFalse;
|
|
j = 0;
|
|
}
|
|
- while (j < fileSpec->getFileName()->getLength()) {
|
|
+ while (j < s1->getLength()) {
|
|
if (isUnicode) {
|
|
u = ((s1->getChar(j) & 0xff) << 8) | (s1->getChar(j+1) & 0xff);
|
|
j += 2;
|
|
@@ -275,14 +283,18 @@
|
|
} else {
|
|
p = path;
|
|
s1 = fileSpec->getFileName();
|
|
- if ((s1->getChar(0) & 0xff) == 0xfe && (s1->getChar(1) & 0xff) == 0xff) {
|
|
+ if (!s1) {
|
|
+ exitCode = 3;
|
|
+ goto err2;
|
|
+ }
|
|
+ if (s1->hasUnicodeMarker()) {
|
|
isUnicode = gTrue;
|
|
j = 2;
|
|
} else {
|
|
isUnicode = gFalse;
|
|
j = 0;
|
|
}
|
|
- while (j < fileSpec->getFileName()->getLength()) {
|
|
+ while (j < s1->getLength()) {
|
|
if (isUnicode) {
|
|
u = ((s1->getChar(j) & 0xff) << 8) | (s1->getChar(j+1) & 0xff);
|
|
j += 2;
|