Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pdf
Manage
Activity
Members
Labels
Plan
Issues
26
Issue boards
Milestones
Wiki
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sven M. Hallberg
pdf
Commits
a0874f26
Commit
a0874f26
authored
5 years ago
by
Sven M. Hallberg
Browse files
Options
Downloads
Patches
Plain Diff
handle linearized PDFs with updates
parent
8b2bafbf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pdf.c
+6
-4
6 additions, 4 deletions
pdf.c
with
6 additions
and
4 deletions
pdf.c
+
6
−
4
View file @
a0874f26
...
@@ -1247,7 +1247,7 @@ parse_xrefs(const char *input, size_t sz, size_t *nxrefs)
...
@@ -1247,7 +1247,7 @@ parse_xrefs(const char *input, size_t sz, size_t *nxrefs)
HParseResult
*
res
=
NULL
;
HParseResult
*
res
=
NULL
;
const
HParsedToken
**
xrefs
=
NULL
;
/* empty result */
const
HParsedToken
**
xrefs
=
NULL
;
/* empty result */
const
HParsedToken
*
tok
=
NULL
;
const
HParsedToken
*
tok
=
NULL
;
size_t
n
=
0
;
size_t
n
=
0
,
nfwd
=
0
;
size_t
offset
=
0
;
size_t
offset
=
0
;
// XXX try formulating this as a parser using h_seek()
// XXX try formulating this as a parser using h_seek()
...
@@ -1296,10 +1296,12 @@ parse_xrefs(const char *input, size_t sz, size_t *nxrefs)
...
@@ -1296,10 +1296,12 @@ parse_xrefs(const char *input, size_t sz, size_t *nxrefs)
* validate the new offset. we don't want to get caught in a
* validate the new offset. we don't want to get caught in a
* loop. the offsets should strictly decrease, unless the file
* loop. the offsets should strictly decrease, unless the file
* is a "linearized" PDF. in that case there should be exactly
* is a "linearized" PDF. in that case there should be exactly
*
two
xref section
s in
the
reverse order, so we allow the
*
one
xref section
at
the
beginning of the file that is
*
first section
to point forward.
*
allowed
to point forward.
*/
*/
if
(
n
>
1
&&
tok
->
sint
>=
offset
)
{
if
(
tok
->
sint
>=
offset
)
nfwd
++
;
if
(
nfwd
>
1
)
{
fprintf
(
stderr
,
"%s: /Prev pointer of xref section at "
fprintf
(
stderr
,
"%s: /Prev pointer of xref section at "
"%zu (%#zx) points forward
\n
"
,
infile
,
offset
,
"%zu (%#zx) points forward
\n
"
,
infile
,
offset
,
offset
);
offset
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment