Skip to content

Commit

Permalink
Merge pull request #1420 from ONLYOFFICE/fix/bug66504
Browse files Browse the repository at this point in the history
Fix bug 66504
  • Loading branch information
K0R0L authored Feb 15, 2024
2 parents 7710090 + 5c69cb0 commit e11f145
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion PdfFile/lib/xpdf/Stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,9 @@ void MemStream::setPos(GFileOffset pos, int dir) {
} else {
i = (Guint)(start + length - pos);
}
if (i < start) {
if (dir < 0 && start + length < pos) {
i = 0;
} else if (i < start) {
i = start;
} else if (i > start + length) {
i = start + length;
Expand Down
10 changes: 5 additions & 5 deletions PdfFile/lib/xpdf/XRef.cc
Original file line number Diff line number Diff line change
Expand Up @@ -419,12 +419,12 @@ GFileOffset XRef::getStartXref() {
nTry = 1;
bFind = false;

do {
bool isBreak = false;
do
{
str->setPos(xrefSearchSize * nTry, -1);
isBreak = str->getPos() == 0;
n = str->getBlock(buf, xrefSearchSize);
if (n <= 0) {
break;
}
buf[n] = '\0';

// find startxref
Expand All @@ -439,7 +439,7 @@ GFileOffset XRef::getStartXref() {
break;
}
nTry++;
} while (str->getPos() > 0);
} while (!isBreak);

// read last xrefSearchSize bytes

Expand Down

0 comments on commit e11f145

Please sign in to comment.