[Pkg-javascript-commits] [pdf.js] 94/106: Ensure that the result of |constructStichedFromIRResult| is a number (issue 6113)

David Prévot taffit at moszumanska.debian.org
Sat Jun 20 21:35:27 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 60fbb5ef69bedd823236549fd0affa02f218208e
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Sun Jun 14 13:44:43 2015 +0200

    Ensure that the result of |constructStichedFromIRResult| is a number (issue 6113)
    
    Fixes 6113.
---
 src/core/function.js         | 5 ++++-
 test/pdfs/issue6113.pdf.link | 1 +
 test/test_manifest.json      | 9 +++++++++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/core/function.js b/src/core/function.js
index 4ea70bb..709c136 100644
--- a/src/core/function.js
+++ b/src/core/function.js
@@ -364,7 +364,10 @@ var PDFFunction = (function PDFFunctionClosure() {
         var rmin = encode[2 * i];
         var rmax = encode[2 * i + 1];
 
-        tmpBuf[0] = rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
+        // Prevent the value from becoming NaN as a result
+        // of division by zero (fixes issue6113.pdf).
+        tmpBuf[0] = dmin === dmax ? rmin :
+                    rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
 
         // call the appropriate function
         fns[i](tmpBuf, 0, dest, destOffset);
diff --git a/test/pdfs/issue6113.pdf.link b/test/pdfs/issue6113.pdf.link
new file mode 100644
index 0000000..9c365c8
--- /dev/null
+++ b/test/pdfs/issue6113.pdf.link
@@ -0,0 +1 @@
+http://web.archive.org/web/20150319000257/http://www.niseko.ne.jp/en/map/pdf/FPmap_en.pdf?1413937768
diff --git a/test/test_manifest.json b/test/test_manifest.json
index 1d0595b..3439a92 100644
--- a/test/test_manifest.json
+++ b/test/test_manifest.json
@@ -1538,6 +1538,15 @@
       "rounds": 1,
       "type": "eq"
     },
+    {  "id": "issue6113",
+       "file": "pdfs/issue6113.pdf",
+       "md5": "7919dbdcd1da04914d7e8dfb05aeb86a",
+       "rounds": 1,
+       "link": true,
+       "firstPage": 1,
+       "lastPage": 1,
+       "type": "eq"
+    },
     {  "id": "blendmode",
       "file": "pdfs/blendmode.pdf",
       "md5": "5a86e7e9333e93c58abc3f382e1e6ea2",

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list