Pdf.js: Out of bounds protection in backtrackBeforeAllVisibleElements

Created on 21 Aug 2018  路  2Comments  路  Source: mozilla/pdf.js

Found an out of bounds index in Line 555: node_modules/pdfjs-dist/web/pdf_viewer.js in function backtrackBeforeAllVisibleElements:

Here is the file containing backtrackBeforeAllVisibleElements: https://github.com/mozilla/pdf.js/blob/7e139776692789fee4b2cedb443715665c5adebe/web/ui_utils.js

Adding in views.length <= index:

function backtrackBeforeAllVisibleElements(index, views, top) {
  if (index < 2 || views.length <= index) {     <<<<<  HERE
    return index;
  }
  var elt = views[index].div;

This fixes an out of bounds problem in ng2-pdf-viewer with a 3page pdf we have. Described here:
https://github.com/VadimDez/ng2-pdf-viewer/issues/367#issuecomment-414696693

Is this something we can get into npm pdfjs-dist?

All 2 comments

Please refer to #9895, and in particular https://github.com/mozilla/pdf.js/pull/9895#issuecomment-405515206.

@Snuffleupagus this is now happening with the pdfjs-dist again after the upgrade to the 2.0.943 and it is not related to the ng2-something

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xingxiaoyiyio picture xingxiaoyiyio  路  3Comments

anggikolo11 picture anggikolo11  路  3Comments

BrennanDuffey picture BrennanDuffey  路  3Comments

sujit-baniya picture sujit-baniya  路  3Comments

brandonros picture brandonros  路  3Comments