Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
poppler
poppler
Commits
407293bf
Commit
407293bf
authored
Dec 16, 2020
by
Albert Astals Cid
Browse files
Fix potential data loss if we try to fetch a non existing Ref after modifying the document
parent
b162c710
Pipeline
#244983
passed with stages
in 11 minutes and 54 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
poppler/XRef.cc
View file @
407293bf
...
...
@@ -1208,6 +1208,20 @@ Object XRef::fetch(int num, int gen, int recursion, Goffset *endPos)
err:
if
(
!
xRefStream
&&
!
xrefReconstructed
)
{
// Check if there has been any updated object, if there has been we can't reconstruct because that would mean losing the changes
bool
xrefHasChanges
=
false
;
for
(
int
i
=
0
;
!
xrefHasChanges
&&
i
<
size
;
i
++
)
{
if
(
entries
[
i
].
getFlag
(
XRefEntry
::
Updated
))
{
xrefHasChanges
=
true
;
}
}
if
(
xrefHasChanges
)
{
error
(
errInternal
,
-
1
,
"xref num {0:d} not found but needed, document has changes, reconstruct aborted
\n
"
,
num
);
// pretend we constructed the xref, otherwise we will do this check again and again
xrefReconstructed
=
true
;
return
Object
(
objNull
);
}
error
(
errInternal
,
-
1
,
"xref num {0:d} not found but needed, try to reconstruct
\n
"
,
num
);
rootNum
=
-
1
;
constructXRef
(
&
xrefReconstructed
);
...
...
William Bader
@williamb
mentioned in merge request
!751 (merged)
·
Dec 25, 2020
mentioned in merge request
!751 (merged)
mentioned in merge request !751
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment