1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00
pdf.js/test
Rob Wu fd29bb0c57 Subtract start offset for xrefs in recovery mode
Xref offsets are relative to the start of the PDF data, not to the start
of the PDF file. This is clear if you look at the other code:

- In the XRef's readXRefTable and processXRefTable methods of XRef, the
  offset of a xref entry is set to the bytes as given by a PDF file.
  These values are always relative to the start of the PDF file (%PDF-).

- The XRef's readXRef method adds the start offset of the stream to
  Xref entry's offset: "stream.pos = startXRef + stream.start".
  Clearly, this line assumes that the entry offset excludes the start
  offset.

However, when the PDF is parsed in recovery mode, the xref table is
filled with entries whose offset is relative to the start of the stream
rather than the PDF file. This is incorrect, and the fix is to subtract
the start offset of the stream from the entry's byte offset.

The manually created PDF file serves as a regression test. It is a valid
PDF, except:
- The integer to point to the start of the xref table and the %%EOF
  trailer are missing. This will activate recovery mode in PDF.js
- Some junk was added before the start of the PDF file. This exposes the
  bad offset bug.
2015-07-10 23:33:10 +02:00
..
features cleaned whitespace 2015-02-17 11:07:37 -05:00
font cleaned whitespace 2015-02-17 11:07:37 -05:00
mozcentral cleaned whitespace 2015-02-17 11:07:37 -05:00
pdfs Subtract start offset for xrefs in recovery mode 2015-07-10 23:33:10 +02:00
resources Merge pull request #5905 from timvandermeij/specialpowers 2015-04-27 10:36:54 -07:00
stats cleaned whitespace 2015-02-17 11:07:37 -05:00
ttx Fix typo in test/ttx/README.md 2014-03-28 00:05:22 +01:00
unit Merge pull request #5585 from timvandermeij/annotation-layer-borderstyle 2015-07-01 10:48:12 -07:00
.gitignore Ignore test snapshots directory. 2013-03-15 11:24:08 -07:00
downloadutils.js Fixes lint warning W004 in /test 2014-04-11 00:02:33 +02:00
driver.js Implement an option to disable automatic scrolling 2015-05-21 20:19:36 +02:00
test.js Add --downloadOnly flag to test.js 2015-07-06 17:17:11 +02:00
test_manifest.json Subtract start offset for xrefs in recovery mode 2015-07-10 23:33:10 +02:00
test_slave.html Implement an option to disable automatic scrolling 2015-05-21 20:19:36 +02:00
testutils.js Fixes lint warning W004 in /test 2014-04-11 00:02:33 +02:00
webbrowser.js Fail with a more informative error message if the browser executable path doesn't exist 2015-04-17 16:12:13 +02:00
webserver.js Fix lint error: "test/webserver.js: line 177, col 106, Line is too long." 2015-01-08 12:22:34 +01:00